Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Cedric Venet | 3d65864 | 2009-02-14 20:20:19 +0000 | [diff] [blame] | 2 | class A { }; |
| 3 | |
| 4 | class B1 : A { }; |
| 5 | |
| 6 | class B2 : virtual A { }; |
| 7 | |
| 8 | class B3 : virtual virtual A { }; // expected-error{{duplicate 'virtual' in base specifier}} |
| 9 | |
| 10 | class C : public B1, private B2 { }; |
| 11 | |
| 12 | |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 13 | class D; // expected-note {{forward declaration of 'D'}} |
Cedric Venet | 3d65864 | 2009-02-14 20:20:19 +0000 | [diff] [blame] | 14 | |
| 15 | class E : public D { }; // expected-error{{base class has incomplete type}} |
| 16 | |
| 17 | typedef int I; |
| 18 | |
| 19 | class F : public I { }; // expected-error{{base specifier must name a class}} |
| 20 | |
| 21 | union U1 : public A { }; // expected-error{{unions cannot have base classes}} |
| 22 | |
| 23 | union U2 {}; |
| 24 | |
| 25 | class G : public U2 { }; // expected-error{{unions cannot be base classes}} |
| 26 | |
| 27 | typedef G G_copy; |
| 28 | typedef G G_copy_2; |
| 29 | typedef G_copy G_copy_3; |
| 30 | |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 31 | class H : G_copy, A, G_copy_2, // expected-error{{base class 'G_copy' (aka 'G') specified more than once as a direct base class}} |
| 32 | public G_copy_3 { }; // expected-error{{base class 'G_copy' (aka 'G') specified more than once as a direct base class}} |
David Majnemer | 4ce94dc | 2013-11-02 12:11:58 +0000 | [diff] [blame] | 33 | |
| 34 | struct J { char c; int i[]; }; |
| 35 | struct K : J { }; // expected-error{{base class 'J' has a flexible array member}} |