Check for an invalid field earlier in a constructor's initialization

of that field. Otherwise, we can end up building and later trying to
instantiate a dependent member initializer that will fail at
instantiation time. 

Unfortunately, I've only managed to trigger this bug with very large
sources, so there's no test case :(

llvm-svn: 118306
This commit is contained in:
Douglas Gregor 2010-11-05 22:21:31 +00:00
parent b0ca9eb294
commit 266bb5fd5b
1 changed files with 3 additions and 3 deletions

View File

@ -1252,6 +1252,9 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
unsigned NumArgs, SourceLocation IdLoc,
SourceLocation LParenLoc,
SourceLocation RParenLoc) {
if (Member->isInvalidDecl())
return true;
// Diagnose value-uses of fields to initialize themselves, e.g.
// foo(foo)
// where foo is not also a parameter to the constructor.
@ -1294,9 +1297,6 @@ Sema::BuildMemberInitializer(FieldDecl *Member, Expr **Args,
}
if (Member->isInvalidDecl())
return true;
// Initialize the member.
InitializedEntity MemberEntity =
InitializedEntity::InitializeMember(Member, 0);