Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 9617433 | 2009-07-01 19:21:19 +0000 | [diff] [blame] | 2 | |
| 3 | template<class X> struct A {}; |
| 4 | |
| 5 | template<class X> struct B : A<X> { |
| 6 | B() : A<X>() {} |
| 7 | }; |
| 8 | B<int> x; |
| 9 | |
| 10 | template<class X> struct B1 : A<X> { |
| 11 | typedef A<X> Base; |
| 12 | B1() : Base() {} |
| 13 | }; |
| 14 | B1<int> x1; |
| 15 | |
| 16 | |
| 17 | template<typename T> struct Tmpl { }; |
| 18 | |
| 19 | template<typename T> struct TmplB { }; |
| 20 | |
| 21 | struct TmplC : Tmpl<int> { |
| 22 | TmplC() : |
| 23 | Tmpl<int>(), |
| 24 | TmplB<int>() { } // expected-error {{type 'TmplB<int>' is not a direct or virtual base of 'TmplC'}} |
| 25 | }; |
| 26 | |
| 27 | |
| 28 | struct TmplD : Tmpl<char>, TmplB<char> { |
| 29 | TmplD(): |
| 30 | Tmpl<int>(), // expected-error {{type 'Tmpl<int>' is not a direct or virtual base of 'TmplD'}} |
| 31 | TmplB<char>() {} |
| 32 | }; |
| 33 | |