| 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 |
|
| 6 |
int g1(int); |
| 7 |
template <class T> decltype(g1(T())) f1(); |
| 8 |
int g1(); |
| 9 |
template <class T> decltype(g1(T())) f1() |
| 10 |
{ return g1(T()); } |
| 11 |
int i1 = f1<int>(); // OK, g1(int) was declared before the first f1 |
| 12 |
|
| 13 |
template <class T> decltype(g2(T())) f2(); // { dg-error "g2. was not declared" } |
| 14 |
int g2(int); |
| 15 |
template <class T> decltype(g2(T())) f2() |
| 16 |
{ return g2(T()); } |
| 17 |
int i2 = f2<int>(); // { dg-error "no match" } |
| 18 |
|
| 19 |
int g3(); |
| 20 |
template <class T> decltype(g3(T())) f3(); // { dg-error "too many arguments" } |
| 21 |
int g3(int); |
| 22 |
template <class T> decltype(g3(T())) f3() |
| 23 |
{ return g3(T()); } |
| 24 |
int i3 = f3<int>(); // { dg-error "no match" } |