]> granicus.if.org Git - clang/commitdiff
Along the error path for lambdas, mark the lambda class as invalid and finalize it
authorDouglas Gregor <dgregor@apple.com>
Thu, 9 Feb 2012 01:28:42 +0000 (01:28 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 9 Feb 2012 01:28:42 +0000 (01:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150130 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLambda.cpp

index b90f5e3d63998c5f55d69d08540b091e5445dc10..033bf4ab3c1e16e4ce279025d363c64ddddadad3 100644 (file)
@@ -265,6 +265,16 @@ void Sema::ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope) {
 
   // Leave the context of the lambda.
   PopDeclContext();
+
+  // Finalize the lambda.
+  LambdaScopeInfo *LSI = getCurLambda();
+  CXXRecordDecl *Class = LSI->Lambda;
+  Class->setInvalidDecl();
+  SmallVector<Decl*, 4> Fields(Class->field_begin(), Class->field_end());
+  ActOnFields(0, Class->getLocation(), Class, Fields, 
+              SourceLocation(), SourceLocation(), 0);
+  CheckCompletedCXXClass(Class);
+
   PopFunctionScopeInfo();
 }