Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | struct A { |
| 4 | A() : value(), cvalue() { } // expected-error {{cannot initialize the member to null in default constructor because reference member 'value' cannot be null-initialized}} \ |
| 5 | // expected-error {{constructor for 'struct A' must explicitly initialize the reference member 'value'}} |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame^] | 6 | int &value; // expected-note{{declared at}} {{expected-note{{declared at}} |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 7 | const int cvalue; |
| 8 | }; |
| 9 | |
| 10 | struct B { |
| 11 | }; |
| 12 | |
| 13 | struct X { |
Mike Stump | 1eb4433 | 2009-09-09 15:08:12 +0000 | [diff] [blame^] | 14 | X() { } // expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'value'}} \ |
| 15 | // expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cvalue'}} \ |
| 16 | // expected-error {{constructor for 'struct X' must explicitly initialize the reference member 'b'}} \ |
| 17 | // expected-error {{constructor for 'struct X' must explicitly initialize the const member 'cb'}} |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 18 | int &value; // expected-note{{declared at}} |
| 19 | const int cvalue; // expected-note{{declared at}} |
| 20 | B& b; // expected-note{{declared at}} |
| 21 | const B cb; // expected-note{{declared at}} |
| 22 | }; |