// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1z %s
// An aggregate is an array or a class...
;
bool b;
Aggr ag = ;
// with no user-provided constructors, ...
;
NonAggr1a na1a = ; // expected-error {{no matching constructor for initialization of 'NonAggr1a'}}
;
NonAggr1b na1b = ; // expected-error {{no matching constructor for initialization of 'NonAggr1b'}}
// no brace-or-equal-initializers for non-static data members, ...
// Note, this bullet was removed in C++1y.
;
NonAggr2 na2 = ;
// expected-error@-2 {{no matching constructor for initialization of 'NonAggr2'}}
// expected-note@-6 3 {{candidate constructor}}
// no private...
;
NonAggr3 na3 = ; // expected-error {{no matching constructor for initialization of 'NonAggr3'}}
// or protected non-static data members, ...
;
NonAggr4 na4 = ; // expected-error {{no matching constructor for initialization of 'NonAggr4'}}
// [pre-C++1z] no base classes, ...
;
NonAggr5 na5 = ;
// expected-error@-2 {{no matching constructor for initialization of 'NonAggr5'}}
// expected-note@-5 3 {{candidate constructor}}
;
MaybeAggr5a<> ma5a0 = ; // ok
MaybeAggr5a<Aggr> ma5a1 = ; // ok in C++17
MaybeAggr5a<NonAggr2> m5a2 = ; // ok, aggregate init in C++17, default ctor in C++11 and C++14
MaybeAggr5a<NonAggr2> m5a3 = ; // ok in C++17, overrides default member initializer in base class
// expected-error@-4 {{call to implicitly-deleted default constructor of 'MaybeAggr5a<Aggr>'}}
// expected-note@-7 {{default constructor of 'MaybeAggr5a<Aggr>' is implicitly deleted because base class 'Aggr' has a deleted default constructor}}
// expected-note@13 {{default constructor of 'Aggr' is implicitly deleted because field 'br' of reference type 'bool &' would not be initialized}}
// expected-error@-5 {{no matching constructor}} expected-note@-9 3{{candidate}}
// expected-error@-9 {{reference member of type 'bool &' uninitialized}}
// expected-note@13 {{uninitialized reference member is here}}
// [C++1z] no virtual, protected, or private base classes, ...
; // expected-note 3{{candidate}}
NonAggr5b na5b = ; // expected-error {{no matching constructor}}
; // expected-note 3{{candidate}}
NonAggr5c na5c = ; // expected-error {{no matching constructor}}
; // expected-note 3{{candidate}}
NonAggr5d na5d = ; // expected-error {{no matching constructor}}
; // expected-note 3{{candidate}}
NonAggr5e na5e = ; // expected-error {{no matching constructor}}
; // expected-note 3{{candidate}}
NonAggr5f na5f = ; // expected-error {{no matching constructor}}
// [C++1z] (the base class need not itself be an aggregate)
;
MaybeAggr5g ma5g1 = ;
MaybeAggr5g ma5g2 = ;
MaybeAggr5g ma5g3 = ;
// expected-error@-4 {{no matching constructor}} // expected-note@-5 3{{candidate}}
// expected-error@-4 {{no matching constructor}} // expected-note@-6 3{{candidate}}
// expected-error@-4 {{implicitly-deleted default constructor}} expected-note@-7 {{no default constructor}}
// expected-error@-8 {{no viable conversion from 'int' to 'NonAggr1a'}} expected-note@19 2{{candidate}}
// (ok)
// expected-error@-8 {{no matching constructor}} expected-note@19 2{{candidate}} expected-note@20 {{candidate}}
// and no virtual functions.
;
NonAggr6 na6 = ; // expected-error {{no matching constructor for initialization of 'NonAggr6'}}
;
NonAggr7 na7 = ; // expected-error {{no matching constructor for initialization of 'NonAggr7'}}
;
DefaultedAggr da = ;
;
ExplicitDefaultedAggr eda = ; // expected-error {{no matching constructor}}
ExplicitDefaultedAggr eda2;
;
;
InheritingConstructors ic = ; // expected-error {{no matching constructor}}
; // expected-note 0+ {{candidate}}
NonInheritingConstructors nic = ;
// expected-error@-2 {{no matching constructor}}
;
; // expected-note 0+ {{candidate}}
HasNonAggrBase hnab = ;
// expected-error@-2 {{no matching constructor}}