2013-08-10 07:37:05 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
2009-08-26 00:37:49 +08:00
|
|
|
|
|
|
|
template<typename A> class s0 {
|
|
|
|
|
|
|
|
template<typename B> class s1 : public s0<A> {
|
|
|
|
~s1() {}
|
|
|
|
s0<A> ms0;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-11-21 03:58:21 +08:00
|
|
|
struct Incomplete;
|
2009-08-26 00:37:49 +08:00
|
|
|
|
2009-11-21 03:58:21 +08:00
|
|
|
template<typename T>
|
|
|
|
void destroy_me(T me) {
|
|
|
|
me.~T();
|
|
|
|
}
|
|
|
|
|
|
|
|
template void destroy_me(Incomplete*);
|
2010-02-17 03:09:40 +08:00
|
|
|
|
|
|
|
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();
|
2010-02-25 09:56:36 +08:00
|
|
|
y->template Y<T>::~Y<T>();
|
|
|
|
y->~Y();
|
2010-02-17 03:09:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template struct X<int>;
|
|
|
|
}
|
|
|
|
|
2010-04-23 12:51:46 +08:00
|
|
|
namespace cvquals {
|
|
|
|
template<typename T>
|
|
|
|
void f(int *ptr) {
|
|
|
|
ptr->~T();
|
|
|
|
}
|
|
|
|
|
|
|
|
template void f<const volatile int>(int *);
|
|
|
|
}
|
2010-05-27 23:25:59 +08:00
|
|
|
|
|
|
|
namespace PR7239 {
|
|
|
|
template<class E> class A { };
|
|
|
|
class B {
|
|
|
|
void f() {
|
|
|
|
A<int>* x;
|
|
|
|
x->A<int>::~A<int>();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2011-03-05 06:45:55 +08:00
|
|
|
|
|
|
|
namespace PR7904 {
|
2015-01-15 15:04:38 +08:00
|
|
|
struct Foo {};
|
|
|
|
template <class T>
|
|
|
|
Foo::~Foo() { // expected-error{{destructor cannot be declared as a template}}
|
|
|
|
T t;
|
|
|
|
T &pT = t;
|
|
|
|
pT;
|
|
|
|
}
|
2011-03-05 06:45:55 +08:00
|
|
|
Foo f;
|
|
|
|
}
|
2013-03-09 05:25:01 +08:00
|
|
|
|
|
|
|
namespace rdar13140795 {
|
|
|
|
template <class T> class shared_ptr {};
|
|
|
|
|
|
|
|
template <typename T> struct Marshal {
|
|
|
|
static int gc();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T> int Marshal<T>::gc() {
|
|
|
|
shared_ptr<T> *x;
|
|
|
|
x->template shared_ptr<T>::~shared_ptr();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
Marshal<int>::gc();
|
|
|
|
}
|
|
|
|
}
|
2013-08-10 07:37:05 +08:00
|
|
|
|
|
|
|
namespace PR16852 {
|
|
|
|
template<typename T> struct S { int a; T x; };
|
|
|
|
template<typename T> decltype(S<T>().~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'}}
|
|
|
|
}
|