]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.old-deja/g++.robertl/eb43.C
PR c++/90047 - ICE with enable_if alias template.
[thirdparty/gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb43.C
1 // { dg-do assemble }
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.
6
7 // { dg-prune-output "note" }
8
9 #include <vector>
10 #include <algorithm>
11 #include <functional>
12
13 using namespace std;
14
15 template <class T> class Expr
16 {
17 public :
18 Expr(){}
19 Expr(const T&){}
20 };
21
22 template <class T >
23 inline bool compare(const Expr<T> a, const Expr<T> b){ return true; }
24
25 int main()
26 {
27 vector<int> a(3);
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<>) );
44 }
45
46 // { dg-prune-output "enable_if" }