PR c++/85765 - SFINAE and non-type default template arg.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / fntmpdefarg10.C
blobf0f9dfb73dce02c34bb08b4b86eeb68384b27476
1 // PR c++/85765
2 // { dg-do compile { target c++11 } }
4 struct il { il(); il(const il&); };
6 int* begin(il);
8 template<class T> T&& declval();
10 template<class T, class U = decltype(begin(declval<T&>())), decltype(*U(),0) = 0>
11 U g(T& t, long) { return begin(t); } // #1
13 template<class T>
14 int g(T& t, ...); // #2
16 volatile il a;
18 auto n = g(a, 0); // calls #1 and ends with a hard error, should call #2