1 // PR c++/85765
2 // { dg-do compile { target c++11 } }
3 
4 struct il { il(); il(const il&); };
5 
6 int* begin(il);
7 
8 template<class T> T&& declval();
9 
10 template<class T, class U = decltype(begin(declval<T&>())), decltype(*U(),0) = 0>
g(T & t,long)11 U g(T& t, long) { return begin(t); } // #1
12 
13 template<class T>
14 int g(T& t, ...); // #2
15 
16 volatile il a;
17 
18 auto n = g(a, 0); // calls #1 and ends with a hard error, should call #2
19