]> granicus.if.org Git - clang/commitdiff
Don't try to implicitly declare special members of an invalid class.
authorJohn McCall <rjmccall@apple.com>
Wed, 11 Aug 2010 23:52:36 +0000 (23:52 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 11 Aug 2010 23:52:36 +0000 (23:52 +0000)
Fixes a crash in a rather large and difficult-to-reduce test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110882 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp

index a54716c679be8ae7086fac0b975356477270c040..024aa131bede2e97a486201fc41ff9a430f2bc7a 100644 (file)
@@ -469,6 +469,10 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) {
 /// the class at this point.
 static bool CanDeclareSpecialMemberFunction(ASTContext &Context,
                                             const CXXRecordDecl *Class) {
+  // Don't do it if the class is invalid.
+  if (Class->isInvalidDecl())
+    return false;
+  
   // We need to have a definition for the class.
   if (!Class->getDefinition() || Class->isDependentContext())
     return false;