2009-06-21 04:23:38 +08:00
// RUN: clang-cc -fsyntax-only -verify %s
struct X1 { // has no implicit default constructor
X1 ( int ) ;
} ;
struct X2 : X1 { / / expected - note { { ' struct X2 ' declared here } } \
// expected-note {{'struct X2' declared here}}
X2 ( int ) ;
} ;
struct X3 : public X2 {
} ;
2009-10-09 06:15:49 +08:00
X3 x3 ; // expected-error {{cannot define the implicit default constructor for 'struct X3', because base class 'struct X2' does not have any default constructor}}
2009-06-21 04:23:38 +08:00
struct X4 {
2009-10-09 06:15:49 +08:00
X2 x2 ; // expected-note {{member is declared here}}
2009-06-21 04:23:38 +08:00
X2 & rx2 ; // expected-note {{declared at}}
} ;
2009-10-09 06:15:49 +08:00
X4 x4 ; / / expected - error { { cannot define the implicit default constructor for ' struct X4 ' , because member ' s type ' struct X2 ' does not have any default constructor } } \
2009-07-10 01:37:12 +08:00
// expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member 'rx2' cannot be default-initialized}}
2009-06-21 04:23:38 +08:00
struct Y1 { // has no implicit default constructor
Y1 ( int ) ;
} ;
struct Y2 : Y1 {
Y2 ( int ) ;
Y2 ( ) ;
} ;
struct Y3 : public Y2 {
} ;
Y3 y3 ;
struct Y4 {
Y2 y2 ;
} ;
Y4 y4 ;
// More tests
struct Z1 {
2009-09-09 23:08:12 +08:00
int & z ; // expected-note {{declared at}}
const int c1 ; // expected-note {{declared at}}
volatile int v1 ;
2009-06-21 04:23:38 +08:00
} ;
2009-07-10 01:37:12 +08:00
Z1 z1 ; / / expected - error { { cannot define the implicit default constructor for ' struct Z1 ' , because reference member ' z ' cannot be default - initialized } } \
// expected-error {{cannot define the implicit default constructor for 'struct Z1', because const member 'c1' cannot be default-initialized}}
2009-06-21 04:23:38 +08:00