1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | |
3 | struct A { |
4 | A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}} |
5 | int &value; |
6 | const int cvalue; |
7 | }; |
8 | |
9 | struct B { |
10 | int field; |
11 | }; |
12 | |
13 | struct X { |
14 | X() { } // expected-error {{constructor for 'X' must explicitly initialize the reference member 'value'}} \ |
15 | // expected-error {{constructor for 'X' must explicitly initialize the const member 'cvalue'}} \ |
16 | // expected-error {{constructor for 'X' must explicitly initialize the reference member 'b'}} \ |
17 | // expected-error {{constructor for 'X' must explicitly initialize the const member 'cb'}} |
18 | int &value; // expected-note{{declared here}} |
19 | const int cvalue; // expected-note{{declared here}} |
20 | B& b; // expected-note{{declared here}} |
21 | const B cb; // expected-note{{declared here}} |
22 | }; |
23 | |
24 | |
25 | // PR5924 |
26 | struct bar {}; |
27 | bar xxx(); |
28 | |
29 | struct foo { |
30 | foo_t a; // expected-error {{unknown type name 'foo_t'}} |
31 | foo() : a(xxx()) {} // no error here. |
32 | }; |
33 | |