146841e1bSDouglas Gregor // RUN: %clang_cc1 -fsyntax-only -verify %s
2*c6e68daaSAndy Gibbs // expected-no-diagnostics
346841e1bSDouglas Gregor 
446841e1bSDouglas Gregor // C++0x [basic.lookup.classref]p3:
59f8a02d3SNAKAMURA Takumi //   If the unqualified-id is ~type-name, the type-name is looked up in the
646841e1bSDouglas Gregor //   context of the entire postfix-expression. If the type T of the object
746841e1bSDouglas Gregor //   expression is of a class type C, the type-name is also looked up in the
846841e1bSDouglas Gregor //   scope of class C. At least one of the lookups shall find a name that
946841e1bSDouglas Gregor //   refers to (possibly cv-qualified) T.
1046841e1bSDouglas Gregor 
1146841e1bSDouglas Gregor // From core issue 305
1246841e1bSDouglas Gregor struct A {
1346841e1bSDouglas Gregor };
1446841e1bSDouglas Gregor 
1546841e1bSDouglas Gregor struct C {
1646841e1bSDouglas Gregor   struct A {};
1746841e1bSDouglas Gregor   void f ();
1846841e1bSDouglas Gregor };
1946841e1bSDouglas Gregor 
f()2046841e1bSDouglas Gregor void C::f () {
2146841e1bSDouglas Gregor   ::A *a;
2246841e1bSDouglas Gregor   a->~A ();
2346841e1bSDouglas Gregor }
2446841e1bSDouglas Gregor 
2546841e1bSDouglas Gregor // From core issue 414
2646841e1bSDouglas Gregor struct X {};
f()2746841e1bSDouglas Gregor void f() {
2846841e1bSDouglas Gregor   X x;
2946841e1bSDouglas Gregor   struct X {};
3046841e1bSDouglas Gregor   x.~X();
3146841e1bSDouglas Gregor }
32