aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-10-25 18:39:16 +0000
committerDouglas Gregor <dgregor@apple.com>2012-10-25 18:39:16 +0000
commitc3f1742bdd1ae0091d51168e111cd63861587b13 (patch)
treee0e3cf53d98a205587e16a4634fddcebf6418d82 /test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
parent7c98499ba594116d75555f39a1cce28cd26d76a5 (diff)
When capturing 'this' in a lambda, make sure to update the set of
array-index starting values for the 'this' capture. Fixes <rdar://problem/12426831>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166709 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp')
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
index 678fa4b964..6358215a55 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
@@ -73,3 +73,18 @@ struct ExpectedThisLayout {
static_assert(sizeof(x) == sizeof(ExpectedThisLayout), "Layout mismatch!");
}
};
+
+struct CaptureArrayAndThis {
+ int value;
+
+ void f() {
+ int array[3];
+ [=]() -> int {
+ int result = value;
+ for (unsigned i = 0; i < 3; ++i)
+ result += array[i];
+ return result;
+ }();
+ }
+};
+