blob: 0f9f21f339d1cd89cfd7d3184be74fdab653a25f [file] [log] [blame]
Douglas Gregor3b6afbb2009-09-09 00:23:06 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename U, typename T>
4U f0(T t) {
5 return t.template get<U>();
6}
7
8template<typename U, typename T>
9int &f1(T t) {
10 // FIXME: When we pretty-print this, we lose the "template" keyword.
11 return t.U::template get<int&>();
12}
13
14struct X {
15 template<typename T> T get();
16};
17
18void test_f0(X x) {
19 int i = f0<int>(x);
20 int &ir = f0<int&>(x);
21}
22
23struct XDerived : public X {
24};
25
26void test_f1(XDerived xd) {
Douglas Gregor6cd21982009-10-20 05:58:46 +000027 int &ir = f1<X>(xd);
Douglas Gregor3b6afbb2009-09-09 00:23:06 +000028}
29
Douglas Gregordd62b152009-10-19 22:04:39 +000030// PR5213
31template <class T>
32struct A {};
33
34template<class T>
35class B
36{
37 A<T> a_;
38
39public:
40 void destroy();
41};
42
43template<class T>
44void
45B<T>::destroy()
46{
47 a_.~A<T>();
48}
49
50void do_destroy_B(B<int> b) {
51 b.destroy();
52}