1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 typedef Foo Bar; // expected-note{{type 'Bar' (aka 'Foo') is declared here}}
14 typedef int OtherInteger;
18 void cv_test(const volatile T* cvt) {
19 cvt->T::~T(); // no-warning
22 void f(A* a, Foo *f, int *i, double *d, int ii) {
26 a->~foo(); // expected-error{{identifier 'foo' in object destruction expression does not name a type}}
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}}
32 i->~Bar(); // expected-error{{does not match}}
34 g().~Bar(); // expected-error{{non-scalar}}
37 f->N::~Wibble(); // FIXME: technically, Wibble isn't a class-name
39 f->::~Bar(17, 42); // expected-error{{cannot have any arguments}}
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}}
49 ii->~Integer(); // expected-error{{member reference type 'int' is not a pointer; did you mean to use '.'?}}
61 void destroy_without_call(int *ip) {
62 ip->~Integer; // expected-error{{reference to pseudo-destructor must be called}}
65 void paren_destroy_with_call(int *ip) {
74 void test_X0(N1::X0 &x0) {
82 p->~oops(); // expected-error{{expected the class name after '~' to name a destructor}}
85 template void destroy(int*); // expected-note{{in instantiation of function template specialization}}
88 template<typename T> using Id = T;
89 void AliasTemplate(int *p) {
93 namespace dotPointerAccess {
98 struct Derived : Base {
104 static_cast<Base *>(&d).~Base(); // expected-error {{member reference type 'dotPointerAccess::Base *' is a pointer; did you mean to use '->'}}
105 d->~Derived(); // expected-error {{member reference type 'dotPointerAccess::Derived' is not a pointer; did you mean to use '.'}}
108 typedef Derived *Foo;
111 d.~Foo(); // This is ok
112 d.~Derived(); // expected-error {{member reference type 'dotPointerAccess::Foo' (aka 'dotPointerAccess::Derived *') is a pointer; did you mean to use '->'}}