[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / inherit.cpp
blobabeed9ab4755dbcb89af00bdd9b470d0405c85b1
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 class A { };
4 class B1 : A { };
6 class B2 : virtual A { };
8 class B3 : virtual virtual A { }; // expected-error{{duplicate 'virtual' in base specifier}}
10 class C : public B1, private B2 { };
13 class D; // expected-note {{forward declaration of 'D'}}
15 class E : public D { }; // expected-error{{base class has incomplete type}}
17 typedef int I;
19 class F : public I { }; // expected-error{{base specifier must name a class}}
21 union U1 : public A { }; // expected-error{{unions cannot have base classes}}
23 union U2 {};
25 class G : public U2 { }; // expected-error{{unions cannot be base classes}}
27 typedef G G_copy;
28 typedef G G_copy_2;
29 typedef G_copy G_copy_3;
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}}
34 struct J { char c; int i[]; };
35 struct K : J { }; // expected-error{{base class 'J' has a flexible array member}}