OSDN Git Service

PR c++/51401
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / cpp0x / sfinae27.C
1 // PR c++/50157
2 // { dg-options -std=c++0x }
3
4 template<class T>
5 T val();
6
7 template<class T, class Arg, class =
8   decltype(::new T(val<Arg>()))
9 >
10 auto test(int) -> char;
11
12 template<class, class>
13 auto test(...) -> char (&)[2];
14
15 struct P {
16   explicit operator bool(); // (#13)
17 };
18
19 typedef decltype(test<bool, P>(0)) type; // OK
20 typedef decltype(test<float, P>(0)) type2; // Error (#17)