summaryrefslogtreecommitdiff
path: root/clang/test/SemaTemplate/destructor-template.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaTemplate/destructor-template.cpp')
-rw-r--r--clang/test/SemaTemplate/destructor-template.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/destructor-template.cpp b/clang/test/SemaTemplate/destructor-template.cpp
new file mode 100644
index 0000000..07beda4
--- /dev/null
+++ b/clang/test/SemaTemplate/destructor-template.cpp
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<typename A> class s0 {
+
+ template<typename B> class s1 : public s0<A> {
+ ~s1() {}
+ s0<A> ms0;
+ };
+
+};
+
+struct Incomplete;
+
+template<typename T>
+void destroy_me(T me) {
+ me.~T();
+}
+
+template void destroy_me(Incomplete*);
+
+namespace PR6152 {
+ template<typename T> struct X { void f(); };
+ template<typename T> struct Y { };
+ template<typename T>
+ void X<T>::f() {
+ Y<T> *y;
+ y->template Y<T>::~Y();
+ y->template Y<T>::~Y<T>();
+ y->~Y();
+ }
+
+ template struct X<int>;
+}
+
+namespace cvquals {
+ template<typename T>
+ void f(int *ptr) {
+ ptr->~T();
+ }
+
+ template void f<const volatile int>(int *);
+}
+
+namespace PR7239 {
+ template<class E> class A { };
+ class B {
+ void f() {
+ A<int>* x;
+ x->A<int>::~A<int>();
+ }
+ };
+}
+
+namespace PR7904 {
+ struct Foo {
+ template <int i> ~Foo() {} // expected-error{{destructor cannot be declared as a template}}
+ };
+ Foo f;
+}