Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 template<typename A> class s0 {
      4 
      5   template<typename B> class s1 : public s0<A> {
      6     ~s1() {}
      7     s0<A> ms0;
      8   };
      9 
     10 };
     11 
     12 struct Incomplete;
     13 
     14 template<typename T>
     15 void destroy_me(T me) {
     16   me.~T();
     17 }
     18 
     19 template void destroy_me(Incomplete*);
     20 
     21 namespace PR6152 {
     22   template<typename T> struct X { void f(); };
     23   template<typename T> struct Y { };
     24   template<typename T>
     25   void X<T>::f() {
     26     Y<T> *y;
     27     y->template Y<T>::~Y();
     28     y->template Y<T>::~Y<T>();
     29     y->~Y();
     30   }
     31 
     32   template struct X<int>;
     33 }
     34 
     35 namespace cvquals {
     36   template<typename T>
     37   void f(int *ptr) {
     38     ptr->~T();
     39   }
     40 
     41   template void f<const volatile int>(int *);
     42 }
     43 
     44 namespace PR7239 {
     45   template<class E> class A { };
     46   class B {
     47     void f() {
     48       A<int>* x;
     49       x->A<int>::~A<int>();
     50     }
     51   };
     52 }
     53 
     54 namespace PR7904 {
     55   struct Foo {
     56     template <int i> ~Foo() {} // expected-error{{destructor cannot be declared as a template}}
     57   };
     58   Foo f;
     59 }
     60