blob: 87069efaacc7468d675bce84f7b5f6310a727b6b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Fariborz Jahanian80545ad2009-09-03 19:36:46 +00002
3struct A {
Douglas Gregor9db7dbb2010-01-31 09:12:51 +00004 A() : value(), cvalue() { } // expected-error {{reference to type 'int' requires an initializer}}
5 int &value;
Fariborz Jahanian80545ad2009-09-03 19:36:46 +00006 const int cvalue;
7};
8
9struct B {
10};
11
12struct X {
John McCall7c2342d2010-03-10 11:27:22 +000013 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'}}
Anders Carlssond1aa8002010-04-23 02:20:12 +000017 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}}
Fariborz Jahanian80545ad2009-09-03 19:36:46 +000021};
Chris Lattner8c3f8902009-12-31 03:10:55 +000022
23
24// PR5924
25struct bar {};
26bar xxx();
27
28struct foo {
29 foo_t a; // expected-error {{unknown type name 'foo_t'}}
30 foo() : a(xxx()) {} // no error here.
31};