From: Douglas Gregor Date: Thu, 9 Feb 2012 01:28:42 +0000 (+0000) Subject: Along the error path for lambdas, mark the lambda class as invalid and finalize it X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=630d5fffdf342128bd73f817013ee91e030daac1;p=clang Along the error path for lambdas, mark the lambda class as invalid and finalize it git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150130 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index b90f5e3d63..033bf4ab3c 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -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 Fields(Class->field_begin(), Class->field_end()); + ActOnFields(0, Class->getLocation(), Class, Fields, + SourceLocation(), SourceLocation(), 0); + CheckCompletedCXXClass(Class); + PopFunctionScopeInfo(); }