overload-uneval.cpp 674 B

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