// { dg-do assemble } // All the pointer_to_binary_function cases used to fail because g++ // couldn't handle converting an overloaded function to a class type. // The first one should still fail because it requires an implicit conversion // to pointer_to_binary_function, which has an `explicit' constructor. // { dg-prune-output "note" } #include #include #include using namespace std; template class Expr { public : Expr(){} Expr(const T&){} }; template inline bool compare(const Expr a, const Expr b){ return true; } int main() { vector a(3); sort( a.begin(), a.end(), static_cast,const Expr)>(compare) ); sort( a.begin(), a.end(), compare ); sort::iterator, pointer_to_binary_function, const Expr, bool> > ( a.begin(), a.end(), compare ); // { dg-error "" } constructor is explicit sort( a.begin(), a.end(), ptr_fun, const Expr, bool> (compare) ); sort( a.begin(), a.end(), ptr_fun(compare) ); sort( a.begin(), a.end(), pointer_to_binary_function, const Expr, bool>(compare) ); sort( a.begin(), a.end(), pointer_to_binary_function, const Expr, bool>(compare) ); sort( a.begin(), a.end(), pointer_to_binary_function, const Expr, bool>(compare<>) ); }