[PATCH] [Sema] Maintain ellipsis location when transforming lambda captures

Meador Inge meadori at gmail.com
Thu Jun 25 17:10:12 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10590

Files:
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp

Index: cfe/trunk/lib/Sema/TreeTransform.h
===================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h
+++ cfe/trunk/lib/Sema/TreeTransform.h
@@ -9399,7 +9399,8 @@
     }
 
     // Capture the transformed variable.
-    getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind);
+    getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind,
+                                 EllipsisLoc);
   }
   if (!FinishedExplicitCaptures)
     getSema().finishLambdaExplicitCaptures(LSI);
Index: cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp
+++ cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp
@@ -933,3 +933,18 @@
     };
   }(0)(0);
 }
+
+namespace PR23716 {
+template<typename T>
+auto f(T x) {
+  auto g = [](auto&&... args) {
+    auto h = [args...]() -> int {
+      return 0;
+    };
+    return h;
+  };
+  return g;
+}
+
+auto x = f(0)();
+}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10590.28518.patch
Type: text/x-patch
Size: 1028 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150626/54051510/attachment.bin>


More information about the cfe-commits mailing list