Home | History | Annotate | Download | only in dcl.init
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 // FIXME: Very incomplete!
      4 
      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.
      9 //
     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.
     13 struct 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}}
     16 };
     17 S s; // expected-note {{implicit default constructor for 'S' first required here}}
     18 S f() {
     19   return S(); // expected-error {{no matching constructor for initialization of 'S'}}
     20 }
     21