Douglas Gregor | 2700dcd | 2009-09-02 23:58:38 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | // XFAIL |
| 3 | template<typename T> |
| 4 | void call_f0(T x) { |
| 5 | x.Base::f0(); |
| 6 | } |
| 7 | |
| 8 | struct Base { |
| 9 | void f0(); |
| 10 | }; |
| 11 | |
| 12 | struct X0 : Base { |
| 13 | typedef Base CrazyBase; |
| 14 | }; |
| 15 | |
| 16 | void test_f0(X0 x0) { |
| 17 | call_f0(x0); |
| 18 | } |
| 19 | |
| 20 | template<typename TheBase, typename T> |
| 21 | void call_f0_through_typedef(T x) { |
| 22 | typedef TheBase Base2; |
| 23 | x.Base2::f0(); |
| 24 | } |
| 25 | |
| 26 | void test_f0_through_typedef(X0 x0) { |
| 27 | call_f0_through_typedef<Base>(x0); |
| 28 | } |
| 29 | |
| 30 | template<typename TheBase, typename T> |
| 31 | void call_f0_through_typedef2(T x) { |
| 32 | typedef TheBase CrazyBase; // expected-note{{current scope}} |
| 33 | x.CrazyBase::f0(); // expected-error{{ambiguous}} |
| 34 | } |
| 35 | |
| 36 | struct OtherBase { }; |
| 37 | |
| 38 | struct X1 : Base, OtherBase { |
| 39 | typedef OtherBase CrazyBase; // expected-note{{object type}} |
| 40 | }; |
| 41 | |
| 42 | void test_f0_through_typedef2(X0 x0, X1 x1) { |
| 43 | call_f0_through_typedef2<Base>(x0); |
| 44 | call_f0_through_typedef2<OtherBase>(x1); |
| 45 | call_f0_through_typedef2<Base>(x1); // expected-note{{here}} |
| 46 | } |
| 47 | |
| 48 | |