[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / illegal-member-initialization.cpp
blob17faed7eff7e7fce070384234da6c0f577451465
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 struct A {
4 A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}}
5 int &value;
6 const int cvalue;
7 };
9 struct B {
10 int field;
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}}
25 // PR5924
26 struct bar {};
27 bar xxx();
29 struct foo {
30 foo_t a; // expected-error {{unknown type name 'foo_t'}}
31 foo() : a(xxx()) {} // no error here.