18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s 23501bcecSFariborz Jahanian 33501bcecSFariborz Jahanian struct A { AA47ae2d775SDouglas Gregor A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}} 57ae2d775SDouglas Gregor int &value; 63501bcecSFariborz Jahanian const int cvalue; 73501bcecSFariborz Jahanian }; 83501bcecSFariborz Jahanian 93501bcecSFariborz Jahanian struct B { 10*6a6376b1SNico Weber int field; 113501bcecSFariborz Jahanian }; 123501bcecSFariborz Jahanian 133501bcecSFariborz Jahanian struct X { XX1485f90559SJohn McCall X() { } // expected-error {{constructor for 'X' must explicitly initialize the reference member 'value'}} \ 1585f90559SJohn McCall // expected-error {{constructor for 'X' must explicitly initialize the const member 'cvalue'}} \ 1685f90559SJohn McCall // expected-error {{constructor for 'X' must explicitly initialize the reference member 'b'}} \ 1785f90559SJohn McCall // expected-error {{constructor for 'X' must explicitly initialize the const member 'cb'}} 1858e24a8fSAnders Carlsson int &value; // expected-note{{declared here}} 1958e24a8fSAnders Carlsson const int cvalue; // expected-note{{declared here}} 2058e24a8fSAnders Carlsson B& b; // expected-note{{declared here}} 2158e24a8fSAnders Carlsson const B cb; // expected-note{{declared here}} 223501bcecSFariborz Jahanian }; 23b0283c06SChris Lattner 24b0283c06SChris Lattner 25b0283c06SChris Lattner // PR5924 26b0283c06SChris Lattner struct bar {}; 27b0283c06SChris Lattner bar xxx(); 28b0283c06SChris Lattner 29b0283c06SChris Lattner struct foo { 30b0283c06SChris Lattner foo_t a; // expected-error {{unknown type name 'foo_t'}} foofoo31b0283c06SChris Lattner foo() : a(xxx()) {} // no error here. 32b0283c06SChris Lattner }; 33