[llvm-branch-commits] [cfe-branch] r118562 - /cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp

Daniel Dunbar daniel at zuster.org
Tue Nov 9 09:31:59 PST 2010


Author: ddunbar
Date: Tue Nov  9 11:31:58 2010
New Revision: 118562

URL: http://llvm.org/viewvc/llvm-project?rev=118562&view=rev
Log:
Merge r118306:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Fri Nov 5 22:21:31 2010 +0000

    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/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp?rev=118562&r1=118561&r2=118562&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaDeclCXX.cpp Tue Nov  9 11:31:58 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 llvm-branch-commits mailing list