| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
// Tests that overload resolution is treated as an unevaluated context. |
| 5 |
// PR5541 |
| 6 |
struct Foo |
| 7 |
{ |
| 8 |
Foo *next; |
| 9 |
}; |
| 10 |
|
| 11 |
template <typename> |
| 12 |
struct Bar |
| 13 |
{ |
| 14 |
}; |
| 15 |
|
| 16 |
|
| 17 |
template <typename T> |
| 18 |
class Wibble |
| 19 |
{ |
| 20 |
typedef Bar<T> B; |
| 21 |
|
| 22 |
static inline B *concrete(Foo *node) { |
| 23 |
int a[sizeof(T) ? -1 : -1]; |
| 24 |
return reinterpret_cast<B *>(node); |
| 25 |
} |
| 26 |
|
| 27 |
public: |
| 28 |
class It |
| 29 |
{ |
| 30 |
Foo *i; |
| 31 |
|
| 32 |
public: |
| 33 |
inline operator B *() const { return concrete(i); } |
| 34 |
inline bool operator!=(const It &o) const { return i != |
| 35 |
o.i; } |
| 36 |
}; |
| 37 |
}; |
| 38 |
|
| 39 |
void f() { |
| 40 |
Wibble<void*>::It a, b; |
| 41 |
|
| 42 |
a != b; |
| 43 |
} |