blob: 6adcdca3e177b2e9aa9ab65f26cf132138d06510 [file] [log] [blame]
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +00001// RUN: clang-cc -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
Eli Friedmand7686ef2009-11-09 01:05:47 +000012struct X3 : public X2 { // expected-error {{must explicitly initialize the base class 'struct X2'}}
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000013};
Eli Friedman9cf6b592009-11-09 19:20:36 +000014X3 x3; // expected-note {{first required here}}
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000015
16
Eli Friedmand7686ef2009-11-09 01:05:47 +000017struct X4 { // expected-error {{must explicitly initialize the member 'x2'}} \
18 // expected-error {{must explicitly initialize the reference member 'rx2'}}
Fariborz Jahanian8ae5b0a2009-10-08 22:15:49 +000019 X2 x2; // expected-note {{member is declared here}}
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000020 X2 & rx2; // expected-note {{declared at}}
21};
22
Eli Friedman9cf6b592009-11-09 19:20:36 +000023X4 x4; // expected-note {{first required here}}
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000024
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
Eli Friedmand7686ef2009-11-09 01:05:47 +000048struct Z1 { // expected-error {{must explicitly initialize the reference member 'z'}} \
49 // expected-error {{must explicitly initialize the const member 'c1'}}
Mike Stump11289f42009-09-09 15:08:12 +000050 int& z; // expected-note {{declared at}}
51 const int c1; // expected-note {{declared at}}
52 volatile int v1;
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000053};
54
Eli Friedman9cf6b592009-11-09 19:20:36 +000055Z1 z1; // expected-note {{first required here}}
Fariborz Jahanian1c9d5d92009-06-20 20:23:38 +000056