| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s |
| 2 |
|
| 3 |
template<typename A> class s0 { |
| 4 |
template<typename B> class s1; |
| 5 |
}; |
| 6 |
|
| 7 |
template<typename A> |
| 8 |
template<typename B> |
| 9 |
class s0<A>::s1 : s0<A> { |
| 10 |
~s1() {} |
| 11 |
s0<A> ms0; |
| 12 |
}; |
| 13 |
|
| 14 |
struct Incomplete; |
| 15 |
|
| 16 |
template<typename T> |
| 17 |
void destroy_me(T me) { |
| 18 |
me.~T(); |
| 19 |
} |
| 20 |
|
| 21 |
template void destroy_me(Incomplete*); |
| 22 |
|
| 23 |
namespace PR6152 { |
| 24 |
template<typename T> struct X { void f(); }; |
| 25 |
template<typename T> struct Y { }; |
| 26 |
template<typename T> |
| 27 |
void X<T>::f() { |
| 28 |
Y<T> *y; |
| 29 |
y->template Y<T>::~Y(); |
| 30 |
y->template Y<T>::~Y<T>(); |
| 31 |
y->~Y(); |
| 32 |
} |
| 33 |
|
| 34 |
template struct X<int>; |
| 35 |
} |
| 36 |
|
| 37 |
namespace cvquals { |
| 38 |
template<typename T> |
| 39 |
void f(int *ptr) { |
| 40 |
ptr->~T(); |
| 41 |
} |
| 42 |
|
| 43 |
template void f<const volatile int>(int *); |
| 44 |
} |
| 45 |
|
| 46 |
namespace PR7239 { |
| 47 |
template<class E> class A { }; |
| 48 |
class B { |
| 49 |
void f() { |
| 50 |
A<int>* x; |
| 51 |
x->A<int>::~A<int>(); |
| 52 |
} |
| 53 |
}; |
| 54 |
} |
| 55 |
|
| 56 |
namespace PR7904 { |
| 57 |
struct Foo {}; |
| 58 |
template <class T> |
| 59 |
Foo::~Foo() { // expected-error{{destructor cannot be declared as a template}} |
| 60 |
T t; |
| 61 |
T &pT = t; |
| 62 |
pT; |
| 63 |
} |
| 64 |
Foo f; |
| 65 |
} |
| 66 |
|
| 67 |
namespace rdar13140795 { |
| 68 |
template <class T> class shared_ptr {}; |
| 69 |
|
| 70 |
template <typename T> struct Marshal { |
| 71 |
static int gc(); |
| 72 |
}; |
| 73 |
|
| 74 |
|
| 75 |
template <typename T> int Marshal<T>::gc() { |
| 76 |
shared_ptr<T> *x; |
| 77 |
x->template shared_ptr<T>::~shared_ptr(); |
| 78 |
return 0; |
| 79 |
} |
| 80 |
|
| 81 |
void test() { |
| 82 |
Marshal<int>::gc(); |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
namespace PR16852 { |
| 87 |
template<typename T> struct S { int a; T x; }; |
| 88 |
template<typename T> decltype(S<T>().~S()) f(); // expected-note {{candidate template ignored: couldn't infer template argument 'T'}} |
| 89 |
void g() { f(); } // expected-error {{no matching function for call to 'f'}} |
| 90 |
} |
| 91 |
|
| 92 |
class PR33189 |
| 93 |
{ |
| 94 |
template <class T> |
| 95 |
~PR33189() { } // expected-error{{destructor cannot be declared as a template}} |
| 96 |
}; |
| 97 |
|
| 98 |
namespace PR38671 { |
| 99 |
struct S { |
| 100 |
template <class> |
| 101 |
~S(); // expected-error{{destructor cannot be declared as a template}} |
| 102 |
}; |
| 103 |
struct T : S { |
| 104 |
~T() = default; |
| 105 |
}; |
| 106 |
} // namespace PR38671 |
| 107 |
|
| 108 |
namespace GH159630 { |
| 109 |
|
| 110 |
struct X { |
| 111 |
template<typename T> |
| 112 |
struct typo { // expected-note {{'typo' declared here}} |
| 113 |
~typo(); |
| 114 |
}; |
| 115 |
}; |
| 116 |
|
| 117 |
template<typename T> |
| 118 |
X::typo<T>::typ0::~typ0() {} // expected-error {{no member named 'typ0'}} \ |
| 119 |
// expected-error {{no type named 'typ0'}} |
| 120 |
|
| 121 |
} |