// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template class s0 { template class s1 : public s0 { ~s1() {} s0 ms0; }; }; struct Incomplete; template void destroy_me(T me) { me.~T(); } template void destroy_me(Incomplete*); namespace PR6152 { template struct X { void f(); }; template struct Y { }; template void X::f() { Y *y; y->template Y::~Y(); y->template Y::~Y(); y->~Y(); } template struct X; } namespace cvquals { template void f(int *ptr) { ptr->~T(); } template void f(int *); } namespace PR7239 { template class A { }; class B { void f() { A* x; x->A::~A(); } }; } namespace PR7904 { struct Foo {}; template Foo::~Foo() { // expected-error{{destructor cannot be declared as a template}} T t; T &pT = t; pT; } Foo f; } namespace rdar13140795 { template class shared_ptr {}; template struct Marshal { static int gc(); }; template int Marshal::gc() { shared_ptr *x; x->template shared_ptr::~shared_ptr(); return 0; } void test() { Marshal::gc(); } } namespace PR16852 { template struct S { int a; T x; }; template decltype(S().~S()) f(); // expected-note {{candidate template ignored: couldn't infer template argument 'T'}} void g() { f(); } // expected-error {{no matching function for call to 'f'}} } class PR33189 { template ~PR33189() { } // expected-error{{destructor cannot be declared as a template}} }; namespace PR38671 { struct S { template ~S(); // expected-error{{destructor cannot be declared as a template}} }; struct T : S { // expected-note{{destructor of 'T' is implicitly deleted because base class 'PR38671::S' has no destructor}} ~T() = default; // expected-warning{{explicitly defaulted destructor is implicitly deleted}} }; } // namespace PR38671