brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 17faed7 Raw
33 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3struct A {4   A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}}5   int &value;6   const int cvalue;7};8 9struct B {10  int field;11};12 13struct 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// PR592426struct bar {};27bar xxx();28 29struct foo {30  foo_t a;  // expected-error {{unknown type name 'foo_t'}}31  foo() : a(xxx()) {}  // no error here.32};33