193649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// RUN: %clang_cc1 -fsyntax-only -verify %s 28e8fb3be5bd78f0564444eca02b404566a5f3b5dAndy Gibbs// expected-no-diagnostics 393649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor 493649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// C++0x [basic.lookup.classref]p3: 5ddddd48da72bc29d1c3f388ed91ea5549328129eNAKAMURA Takumi// If the unqualified-id is ~type-name, the type-name is looked up in the 693649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// context of the entire postfix-expression. If the type T of the object 793649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// expression is of a class type C, the type-name is also looked up in the 893649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// scope of class C. At least one of the lookups shall find a name that 993649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// refers to (possibly cv-qualified) T. 1093649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor 1193649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// From core issue 305 1293649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregorstruct A { 1393649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor}; 1493649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor 1593649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregorstruct C { 1693649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor struct A {}; 1793649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor void f (); 1893649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor}; 1993649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor 2093649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregorvoid C::f () { 2193649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor ::A *a; 2293649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor a->~A (); 2393649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor} 2493649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor 2593649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor// From core issue 414 2693649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregorstruct X {}; 2793649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregorvoid f() { 2893649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor X x; 2993649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor struct X {}; 3093649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor x.~X(); 3193649fdc5e0c46e26bcba06ad39aa80196d3df27Douglas Gregor} 32