1// RUN: %clang_cc1 -fsyntax-only -verify %s 2struct A {}; 3 4enum Foo { F }; 5typedef Foo Bar; // expected-note{{type 'Bar' (aka 'Foo') is declared here}} 6 7typedef int Integer; 8typedef double Double; 9 10void g(); 11 12namespace N { 13 typedef Foo Wibble; 14 typedef int OtherInteger; 15} 16 17template <typename T> 18void cv_test(const volatile T* cvt) { 19 cvt->T::~T(); // no-warning 20} 21 22void f(A* a, Foo *f, int *i, double *d) { 23 a->~A(); 24 a->A::~A(); 25 26 a->~foo(); // expected-error{{identifier 'foo' in object destruction expression does not name a type}} 27 28 a->~Bar(); // expected-error{{destructor type 'Bar' (aka 'Foo') in object destruction expression does not match the type 'A' of the object being destroyed}} 29 30 f->~Bar(); 31 f->~Foo(); 32 i->~Bar(); // expected-error{{does not match}} 33 34 g().~Bar(); // expected-error{{non-scalar}} 35 36 f->::~Bar(); 37 f->N::~Wibble(); // FIXME: technically, Wibble isn't a class-name 38 39 f->::~Bar(17, 42); // expected-error{{cannot have any arguments}} 40 41 i->~Integer(); 42 i->Integer::~Integer(); 43 i->N::~OtherInteger(); 44 i->N::OtherInteger::~OtherInteger(); 45 i->N::OtherInteger::~Integer(); // expected-error{{'Integer' does not refer to a type name in pseudo-destructor expression; expected the name of type 'int'}} 46 i->N::~Integer(); // expected-error{{'Integer' does not refer to a type name in pseudo-destructor expression; expected the name of type 'int'}} 47 i->Integer::~Double(); // expected-error{{the type of object expression ('int') does not match the type being destroyed ('Double' (aka 'double')) in pseudo-destructor expression}} 48 49 cv_test(a); 50 cv_test(f); 51 cv_test(i); 52 cv_test(d); 53} 54 55 56typedef int Integer; 57 58void destroy_without_call(int *ip) { 59 ip->~Integer; // expected-error{{called immediately}} 60} 61 62// PR5530 63namespace N1 { 64 class X0 { }; 65} 66 67void test_X0(N1::X0 &x0) { 68 x0.~X0(); 69} 70 71