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