"default arguments cannot be added to an out-of-line definition of a member "
"of a %select{class template|class template partial specialization|nested "
"class in a template}0">;
+def note_field_decl : Note<"member is declared here">;
def err_defining_default_ctor : Error<
- "cannot define the implicit default constructor for %0, because %select{base class|member}1 "
+ "cannot define the implicit default constructor for %0, because %select{base class|member's type}1 "
"%2 does not have any default constructor">;
def note_previous_class_decl : Note<
"%0 declared here">;
MarkDeclarationReferenced(CurrentLocation, BaseCtor);
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
- << Context.getTagDeclType(ClassDecl) << 1
+ << Context.getTagDeclType(ClassDecl) << 0
<< Context.getTagDeclType(BaseClassDecl);
Diag(BaseClassDecl->getLocation(), diag::note_previous_class_decl)
<< Context.getTagDeclType(BaseClassDecl);
MarkDeclarationReferenced(CurrentLocation, FieldCtor);
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
- << Context.getTagDeclType(ClassDecl) << 0 <<
+ << Context.getTagDeclType(ClassDecl) << 1 <<
Context.getTagDeclType(FieldClassDecl);
+ Diag((*Field)->getLocation(), diag::note_field_decl);
Diag(FieldClassDecl->getLocation(), diag::note_previous_class_decl)
<< Context.getTagDeclType(FieldClassDecl);
err = true;
void g() { }
struct Inner {
- T value;
+ T value; // expected-note {{member is declared here}}
};
static T value;
struct X3 : public X2 {
};
-X3 x3; // expected-error {{cannot define the implicit default constructor for 'struct X3', because member 'struct X2' does not have any default constructor}}
+X3 x3; // expected-error {{cannot define the implicit default constructor for 'struct X3', because base class 'struct X2' does not have any default constructor}}
struct X4 {
- X2 x2;
+ X2 x2; // expected-note {{member is declared here}}
X2 & rx2; // expected-note {{declared at}}
};
-X4 x4; // expected-error {{cannot define the implicit default constructor for 'struct X4', because base class 'struct X2' does not have any default constructor}} \
+X4 x4; // expected-error {{cannot define the implicit default constructor for 'struct X4', because member's type 'struct X2' does not have any default constructor}} \
// expected-error {{cannot define the implicit default constructor for 'struct X4', because reference member 'rx2' cannot be default-initialized}}