blob: 4269991adecfe892570a40f712a2d6dbdc51ba55 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3struct X1 { // has no implicit default constructor
4 X1(int);
5};
6
7struct X2 : X1 { // expected-note {{'struct X2' declared here}} \
8 // expected-note {{'struct X2' declared here}}
9 X2(int);
10};
11
12struct X3 : public X2 { // expected-error {{must explicitly initialize the base class 'struct X2'}}
13};
14X3 x3; // expected-note {{first required here}}
15
16
17struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \
18 // expected-error {{must explicitly initialize the reference member 'rx2'}}
19 X2 x2; // expected-note {{member is declared here}}
20 X2 & rx2; // expected-note {{declared at}}
21};
22
23X4 x4; // expected-note {{first required here}}
24
25
26struct Y1 { // has no implicit default constructor
27 Y1(int);
28};
29
30struct Y2 : Y1 {
31 Y2(int);
32 Y2();
33};
34
35struct Y3 : public Y2 {
36};
37Y3 y3;
38
39struct Y4 {
40 Y2 y2;
41};
42
43Y4 y4;
44
45// More tests
46
47
48struct Z1 { // expected-error {{must explicitly initialize the reference member 'z'}} \
49 // expected-error {{must explicitly initialize the const member 'c1'}}
50 int& z; // expected-note {{declared at}}
51 const int c1; // expected-note {{declared at}}
52 volatile int v1;
53};
54
55Z1 z1; // expected-note {{first required here}}
56