aboutsummaryrefslogtreecommitdiff
path: root/test/SemaTemplate/member-template-access-expr.cpp
blob: 0f9f21f339d1cd89cfd7d3184be74fdab653a25f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// RUN: clang-cc -fsyntax-only -verify %s

template<typename U, typename T>
U f0(T t) {
  return t.template get<U>();
}

template<typename U, typename T>
int &f1(T t) {
  // FIXME: When we pretty-print this, we lose the "template" keyword.
  return t.U::template get<int&>();
}

struct X {
  template<typename T> T get();
};

void test_f0(X x) {
  int i = f0<int>(x);
  int &ir = f0<int&>(x);
}

struct XDerived : public X {
};

void test_f1(XDerived xd) {
  int &ir = f1<X>(xd);
}

// PR5213
template <class T>
struct A {};

template<class T>
class B
{
  A<T> a_;
  
public:
  void destroy();
};

template<class T>
void
B<T>::destroy()
{
  a_.~A<T>();
}

void do_destroy_B(B<int> b) {
  b.destroy();
}