| 1 |
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
using nullptr_t = decltype(nullptr); |
| 4 |
|
| 5 |
template<typename T> |
| 6 |
struct Base { |
| 7 |
T inner; |
| 8 |
}; |
| 9 |
|
| 10 |
int z; |
| 11 |
|
| 12 |
template<typename T> |
| 13 |
struct X : Base<T> { |
| 14 |
static int z; |
| 15 |
|
| 16 |
template<int U> |
| 17 |
struct Inner { |
| 18 |
}; |
| 19 |
|
| 20 |
bool f(T other) { |
| 21 |
// A pair of comparisons; 'inner' is a dependent name so can't be assumed |
| 22 |
// to be a template. |
| 23 |
return this->inner < other > ::z; // expected-error {{chained comparison 'X < Y > Z' does not behave the same as a mathematical expression}} |
| 24 |
} |
| 25 |
}; |
| 26 |
|
| 27 |
void use_x(X<int> x) { x.f(0); } // expected-note {{requested here}} |
| 28 |
|
| 29 |
template<typename T> |
| 30 |
struct Y { |
| 31 |
static int z; |
| 32 |
|
| 33 |
template<int U> |
| 34 |
struct Inner; // expected-note {{declared here}} |
| 35 |
|
| 36 |
bool f(T other) { |
| 37 |
// We can determine that 'inner' does not exist at parse time, so can |
| 38 |
// perform typo correction in this case. |
| 39 |
return this->inner<other>::z; // expected-error {{no template named 'inner' in 'Y<T>'; did you mean 'Inner'?}} |
| 40 |
} |
| 41 |
}; |
| 42 |
|
| 43 |
template<typename T> |
| 44 |
template<int U> |
| 45 |
struct Y<T>::Inner : Y { }; |
| 46 |
|
| 47 |
struct Q { constexpr operator int() { return 0; } }; |
| 48 |
void use_y(Y<Q> x) { x.f(Q()); } |