Use getDeclName in DefineImplicitOverloadedAssign as well.

llvm-svn: 75152
This commit is contained in:
Anders Carlsson 2009-07-09 17:47:25 +00:00
parent b05ce0f395
commit 17973e684d
2 changed files with 20 additions and 4 deletions

View File

@ -2093,15 +2093,15 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation,
}
else if (FieldType->isReferenceType()) {
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
<< Context.getTagDeclType(ClassDecl) << 0 << (*Field)->getNameAsCString();
Diag((*Field)->getLocation(), diag::note_declared_at);
<< Context.getTagDeclType(ClassDecl) << 0 << Field->getDeclName();
Diag(Field->getLocation(), diag::note_declared_at);
Diag(CurrentLocation, diag::note_first_required_here);
err = true;
}
else if (FieldType.isConstQualified()) {
Diag(ClassDecl->getLocation(), diag::err_uninitialized_member_for_assign)
<< Context.getTagDeclType(ClassDecl) << 1 << (*Field)->getNameAsCString();
Diag((*Field)->getLocation(), diag::note_declared_at);
<< Context.getTagDeclType(ClassDecl) << 1 << Field->getDeclName();
Diag(Field->getLocation(), diag::note_declared_at);
Diag(CurrentLocation, diag::note_first_required_here);
err = true;
}

View File

@ -72,3 +72,19 @@ void i()
d1 = d2;
}
// Test5
class E1 { // expected-error{{cannot define the implicit default assignment operator for 'class E1', because non-static const member 'a' can't use default assignment operator}}
public:
const int a; // expected-note{{declared at}}
E1() : a(0) {}
};
E1 e1, e2;
void j()
{
e1 = e2; // expected-note{{synthesized method is first required here}}
}