2 // All the pointer_to_binary_function cases used to fail because g++
3 // couldn't handle converting an overloaded function to a class type.
4 // The first one should still fail because it requires an implicit conversion
5 // to pointer_to_binary_function, which has an `explicit' constructor.
7 // { dg-prune-output "note" }
15 template <class T> class Expr
23 inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }
28 sort( a.begin(), a.end(),
29 static_cast<bool (*)(const Expr<int>,const Expr<int>)>(compare) );
30 sort( a.begin(), a.end(), compare<int> );
31 sort<vector<int>::iterator,
32 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool> >
33 ( a.begin(), a.end(), compare ); // { dg-error "" } constructor is explicit
34 sort( a.begin(), a.end(),
35 ptr_fun<const Expr<int>, const Expr<int>, bool> (compare) );
36 sort( a.begin(), a.end(),
37 ptr_fun(compare<int>) );
38 sort( a.begin(), a.end(),
39 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare) );
40 sort( a.begin(), a.end(),
41 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<int>) );
42 sort( a.begin(), a.end(),
43 pointer_to_binary_function<const Expr<int>, const Expr<int>, bool>(compare<>) );