Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | c87efbd | 2009-08-25 16:37:49 +0000 | [diff] [blame] | 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 | |
Douglas Gregor | 31658df | 2009-11-20 19:58:21 +0000 | [diff] [blame] | 12 | struct Incomplete; |
Fariborz Jahanian | c87efbd | 2009-08-25 16:37:49 +0000 | [diff] [blame] | 13 | |
Douglas Gregor | 31658df | 2009-11-20 19:58:21 +0000 | [diff] [blame] | 14 | template<typename T> |
| 15 | void destroy_me(T me) { |
| 16 | me.~T(); |
| 17 | } |
| 18 | |
| 19 | template void destroy_me(Incomplete*); |
Douglas Gregor | 124b878 | 2010-02-16 19:09:40 +0000 | [diff] [blame] | 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(); |
Douglas Gregor | a2e7dd2 | 2010-02-25 01:56:36 +0000 | [diff] [blame] | 28 | y->template Y<T>::~Y<T>(); |
| 29 | y->~Y(); |
Douglas Gregor | 124b878 | 2010-02-16 19:09:40 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | template struct X<int>; |
| 33 | } |
| 34 | |
Douglas Gregor | 20b3c9d | 2010-04-23 04:51:46 +0000 | [diff] [blame] | 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 | } |
Douglas Gregor | 9f716e4 | 2010-05-27 15:25:59 +0000 | [diff] [blame] | 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 | } |
Douglas Gregor | cb710a4 | 2011-03-04 22:45:55 +0000 | [diff] [blame] | 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 | } |