2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-09-04 03:36:46 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
A() : value(), cvalue() { } // expected-error {{cannot initialize the member to null in default constructor because reference member 'value' cannot be null-initialized}} \
|
|
|
|
// expected-error {{constructor for 'struct A' must explicitly initialize the reference member 'value'}}
|
2009-09-09 23:08:12 +08:00
|
|
|
int &value; // expected-note{{declared at}} {{expected-note{{declared at}}
|
2009-09-04 03:36:46 +08:00
|
|
|
const int cvalue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
};
|
|
|
|
|
|
|
|
struct X {
|
2009-09-09 23:08:12 +08:00
|
|
|
X() { } // expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'value'}} \
|
|
|
|
// expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cvalue'}} \
|
|
|
|
// expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'b'}} \
|
|
|
|
// expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cb'}}
|
2009-09-04 03:36:46 +08:00
|
|
|
int &value; // expected-note{{declared at}}
|
|
|
|
const int cvalue; // expected-note{{declared at}}
|
|
|
|
B& b; // expected-note{{declared at}}
|
|
|
|
const B cb; // expected-note{{declared at}}
|
|
|
|
};
|