From: Richard Smith Date: Wed, 12 Nov 2014 02:09:03 +0000 (+0000) Subject: Try a different workaround for GCC 4.7.2 lambda capture bug. The previous X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2c3e5aaac66e6f490218bb8ee5953fd0f7b4c4e;p=clang Try a different workaround for GCC 4.7.2 lambda capture bug. The previous workaround took us from wrong-code to ICE. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221754 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index ecbc0118bb..62475bc707 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -4579,12 +4579,12 @@ QualType TreeTransform::TransformFunctionProtoType(TypeLocBuilder &TLB, FunctionProtoTypeLoc TL) { SmallVector ExceptionStorage; + TreeTransform *This = this; // Work around gcc.gnu.org/PR56135. return getDerived().TransformFunctionProtoType( TLB, TL, nullptr, 0, - // The explicit 'this' capture is a workaround for gcc.gnu.org/PR56135. - [&, this](FunctionProtoType::ExceptionSpecInfo & ESI, bool &Changed) { - return TransformExceptionSpec(TL.getBeginLoc(), ESI, ExceptionStorage, - Changed); + [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool &Changed) { + return This->TransformExceptionSpec(TL.getBeginLoc(), ESI, + ExceptionStorage, Changed); }); } @@ -9152,11 +9152,12 @@ TreeTransform::TransformLambdaExpr(LambdaExpr *E) { TypeLocBuilder NewCallOpTLBuilder; SmallVector ExceptionStorage; + TreeTransform *This = this; // Work around gcc.gnu.org/PR56135. QualType NewCallOpType = TransformFunctionProtoType( NewCallOpTLBuilder, OldCallOpFPTL, nullptr, 0, - [&, this](FunctionProtoType::ExceptionSpecInfo &ESI, bool &Changed) { - return TransformExceptionSpec(OldCallOpFPTL.getBeginLoc(), ESI, - ExceptionStorage, Changed); + [&](FunctionProtoType::ExceptionSpecInfo &ESI, bool &Changed) { + return This->TransformExceptionSpec(OldCallOpFPTL.getBeginLoc(), ESI, + ExceptionStorage, Changed); }); NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, NewCallOpType);