Try a different workaround for GCC 4.7.2 lambda capture bug. The previous

workaround took us from wrong-code to ICE.

llvm-svn: 221754
This commit is contained in:
Richard Smith 2014-11-12 02:09:03 +00:00
parent 45dc480b75
commit 775118a28b
1 changed files with 8 additions and 7 deletions

View File

@ -4579,12 +4579,12 @@ QualType
TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
FunctionProtoTypeLoc TL) {
SmallVector<QualType, 4> 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<Derived>::TransformLambdaExpr(LambdaExpr *E) {
TypeLocBuilder NewCallOpTLBuilder;
SmallVector<QualType, 4> 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);