PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / template / sfinae17.C
blobeb043cbddfbec165814d483d2fb09f17916aff42
1 // The conversion from D* to B* is ambiguous, but that should not produce
2 // an error, it should remove the first f overload by SFINAE.
4 #define static_assert(TEST,STR) \
5   do { int ar[(TEST)?1:-1]; } while (0);
7 struct B {};
9 struct B1 : B {};
10 struct B2 : B {};
12 struct D : B1, B2 {};
14 template <class T> T create();
16 typedef char one[1];
17 typedef char two[2];
19 template <class T>
20     one &f(char (*)[sizeof static_cast<T>(create<D *>())]);
21 template <class T>
22     two &f(...);
24 int main()
26   static_assert(sizeof f<int>(0) == sizeof(two), "");
27   static_assert(sizeof f<B *>(0) == sizeof(two), "");