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