[cfe-commits] r118306 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Fri Nov 5 15:21:31 PDT 2010
Author: dgregor
Date: Fri Nov 5 17:21:31 2010
New Revision: 118306
URL: http://llvm.org/viewvc/llvm-project?rev=118306&view=rev
Log:
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 :(
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=118306&r1=118305&r2=118306&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Nov 5 17:21:31 2010
@@ -1252,6 +1252,9 @@
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 @@
}
- if (Member->isInvalidDecl())
- return true;
-
// Initialize the member.
InitializedEntity MemberEntity =
InitializedEntity::InitializeMember(Member, 0);
More information about the cfe-commits
mailing list