xref: /llvm-project/clang/test/SemaTemplate/member-template-access-expr.cpp (revision a5cb6da0cdd2a2f97698c30bf09a043b1d38c052)
1 // RUN: clang-cc -fsyntax-only -verify %s
2 
3 template<typename U, typename T>
4 U f0(T t) {
5   return t.template get<U>();
6 }
7 
8 template<typename U, typename T>
9 int &f1(T t) {
10   // FIXME: When we pretty-print this, we lose the "template" keyword.
11   return t.U::template get<int&>();
12 }
13 
14 struct X {
15   template<typename T> T get();
16 };
17 
18 void test_f0(X x) {
19   int i = f0<int>(x);
20   int &ir = f0<int&>(x);
21 }
22 
23 struct XDerived : public X {
24 };
25 
26 void test_f1(XDerived xd) {
27   int &ir = f1<X>(xd);
28 }
29 
30 // PR5213
31 template <class T>
32 struct A {};
33 
34 template<class T>
35 class B
36 {
37   A<T> a_;
38 
39 public:
40   void destroy();
41 };
42 
43 template<class T>
44 void
45 B<T>::destroy()
46 {
47   a_.~A<T>();
48 }
49 
50 void do_destroy_B(B<int> b) {
51   b.destroy();
52 }
53