summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/member-access-expr.cpp
blob: f41dc2120abdfa51fe8913360da7a580b0be3a9e (plain)
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
// RUN: clang-cc -fsyntax-only -verify %s
// XFAIL
template<typename T>
void call_f0(T x) {
  x.Base::f0();
}

struct Base {
  void f0();
};

struct X0 : Base { 
  typedef Base CrazyBase;
};

void test_f0(X0 x0) {
  call_f0(x0);
}

template<typename TheBase, typename T>
void call_f0_through_typedef(T x) {
  typedef TheBase Base2;
  x.Base2::f0();
}

void test_f0_through_typedef(X0 x0) {
  call_f0_through_typedef<Base>(x0);
}

template<typename TheBase, typename T>
void call_f0_through_typedef2(T x) {
  typedef TheBase CrazyBase; // expected-note{{current scope}}
  x.CrazyBase::f0(); // expected-error{{ambiguous}}
}

struct OtherBase { };

struct X1 : Base, OtherBase { 
  typedef OtherBase CrazyBase; // expected-note{{object type}}
};

void test_f0_through_typedef2(X0 x0, X1 x1) {
  call_f0_through_typedef2<Base>(x0);
  call_f0_through_typedef2<OtherBase>(x1);
  call_f0_through_typedef2<Base>(x1); // expected-note{{here}}
}


OpenPOWER on IntegriCloud