Home | History | Annotate | Download | only in SemaCXX
      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 };
     11 
     12 struct X {
     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'}}
     17    int &value; // expected-note{{declared here}}
     18    const int cvalue; // expected-note{{declared here}}
     19    B& b; // expected-note{{declared here}}
     20    const B cb; // expected-note{{declared here}}
     21 };
     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 };
     32