summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2015-06-26 00:09:55 +0000
committerMeador Inge <meadori@codesourcery.com>2015-06-26 00:09:55 +0000
commit4f9dee7511473c86b8e22f76dfc6ed569314e017 (patch)
tree03f2172741713f6f619c7ad65ec1c857276d5dc9 /clang/lib/Sema/TreeTransform.h
parent459a23e0a3f076515b5dbfd0a33273d20d6a60f0 (diff)
downloadbcm5719-llvm-4f9dee7511473c86b8e22f76dfc6ed569314e017.tar.gz
bcm5719-llvm-4f9dee7511473c86b8e22f76dfc6ed569314e017.zip
[Sema] Maintain ellipsis location when transforming lambda captures
This patch fixes a crash caused by the following case: 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)(); When the templated function 'f' is instantiated and the inner-most lambda is transformed the ellipsis location on the captured variable is lost. Then the lambda returned by 'f' is instantiated and the tree transformer chokes on the invalid ellipsis location. The problem is fixed by making a minor change to properly track the ellipsis location. This fixes PR23716. Differential Revision: http://reviews.llvm.org/D10590 llvm-svn: 240740
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 3b2a17c5497..5d9c35f08df 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -9399,7 +9399,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
}
// Capture the transformed variable.
- getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind);
+ getSema().tryCaptureVariable(CapturedVar, C->getLocation(), Kind,
+ EllipsisLoc);
}
if (!FinishedExplicitCaptures)
getSema().finishLambdaExplicitCaptures(LSI);
OpenPOWER on IntegriCloud