1// Core 1321
2// { dg-do compile { target c++11 } }
3// Two dependent names are equivalent even if the overload sets found by
4// phase 1 lookup are different.  Merging them keeps the earlier set.
5
6int g1(int);
7template <class T> decltype(g1(T())) f1();
8int g1();
9template <class T> decltype(g1(T())) f1()
10{ return g1(T()); }
11int i1 = f1<int>();	    // OK, g1(int) was declared before the first f1
12
13template <class T> decltype(g2(T())) f2(); // { dg-error "g2. was not declared" }
14int g2(int);
15template <class T> decltype(g2(T())) f2()
16{ return g2(T()); }
17int i2 = f2<int>();			  // { dg-error "no match" }
18
19int g3();
20template <class T> decltype(g3(T())) f3(); // { dg-error "too many arguments" }
21int g3(int);
22template <class T> decltype(g3(T())) f3()
23{ return g3(T()); }
24int i3 = f3<int>();			  // { dg-error "no match" }
25