Douglas Gregor | 46841e1 | 2010-02-23 00:15:22 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | // C++0x [basic.lookup.classref]p3: |
NAKAMURA Takumi | 9f8a02d | 2011-08-12 05:49:51 +0000 | [diff] [blame] | 4 | // If the unqualified-id is ~type-name, the type-name is looked up in the |
Douglas Gregor | 46841e1 | 2010-02-23 00:15:22 +0000 | [diff] [blame] | 5 | // context of the entire postfix-expression. If the type T of the object |
| 6 | // expression is of a class type C, the type-name is also looked up in the |
| 7 | // scope of class C. At least one of the lookups shall find a name that |
| 8 | // refers to (possibly cv-qualified) T. |
| 9 | |
| 10 | // From core issue 305 |
| 11 | struct A { |
| 12 | }; |
| 13 | |
| 14 | struct C { |
| 15 | struct A {}; |
| 16 | void f (); |
| 17 | }; |
| 18 | |
| 19 | void C::f () { |
| 20 | ::A *a; |
| 21 | a->~A (); |
| 22 | } |
| 23 | |
| 24 | // From core issue 414 |
| 25 | struct X {}; |
| 26 | void f() { |
| 27 | X x; |
| 28 | struct X {}; |
| 29 | x.~X(); |
| 30 | } |