p5.cpp revision 1baf2f778c26a71d1353ff2cc1701fcd1dbeaf76
1// RUN: %clang_cc1 -fsyntax-only -verify %s
3// FIXME: Very incomplete!
5//   A program that calls for default-initialization or value-initialization of
6//   an entity of reference type is illformed. If T is a cv-qualified type, the
7//   cv-unqualified version of T is used for these definitions of
8//   zero-initialization, default-initialization, and value-initialization.
10// FIXME: The diagnostics for these errors are terrible because they fall out
11// of the AST representation rather than being explicitly issued during the
12// respective initialization forms.
13struct S { // expected-error {{implicit default constructor for 'S' must explicitly initialize the reference member}} \
14           // expected-note {{candidate constructor (the implicit copy constructor) not viable}}
15  int& x; // expected-note {{declared here}}
17S s; // expected-note {{implicit default constructor for 'S' first required here}}
18S f() {
19  return S(); // expected-error {{no matching constructor for initialization of 'S'}}