]> granicus.if.org Git - clang/commitdiff
Try a different workaround for GCC 4.7.2 lambda capture bug. The previous
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 12 Nov 2014 02:09:03 +0000 (02:09 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 12 Nov 2014 02:09:03 +0000 (02:09 +0000)
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

lib/Sema/TreeTransform.h

index ecbc0118bb8d8275949a513802af5921c7f811bf..62475bc707e33c1bfd9c969019257d0653fe82b1 100644 (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);