Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 2 | |
| 3 | struct A { |
Douglas Gregor | 9db7dbb | 2010-01-31 09:12:51 +0000 | [diff] [blame] | 4 | A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}} |
| 5 | int &value; |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 6 | const int cvalue; |
| 7 | }; |
| 8 | |
| 9 | struct B { |
| 10 | }; |
| 11 | |
| 12 | struct X { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame^] | 13 | X() { } // expected-error {{constructor for 'X' must explicitly initialize the reference member 'value'}} \ |
| 14 | // expected-error {{constructor for 'X' must explicitly initialize the const member 'cvalue'}} \ |
| 15 | // expected-error {{constructor for 'X' must explicitly initialize the reference member 'b'}} \ |
| 16 | // expected-error {{constructor for 'X' must explicitly initialize the const member 'cb'}} |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 17 | int &value; // expected-note{{declared at}} |
| 18 | const int cvalue; // expected-note{{declared at}} |
| 19 | B& b; // expected-note{{declared at}} |
Douglas Gregor | 9db7dbb | 2010-01-31 09:12:51 +0000 | [diff] [blame] | 20 | const B cb; // expected-note{{declared here}} |
Fariborz Jahanian | 80545ad | 2009-09-03 19:36:46 +0000 | [diff] [blame] | 21 | }; |
Chris Lattner | 8c3f890 | 2009-12-31 03:10:55 +0000 | [diff] [blame] | 22 | |
| 23 | |
| 24 | // PR5924 |
| 25 | struct bar {}; |
| 26 | bar xxx(); |
| 27 | |
| 28 | struct foo { |
| 29 | foo_t a; // expected-error {{unknown type name 'foo_t'}} |
| 30 | foo() : a(xxx()) {} // no error here. |
| 31 | }; |