diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-12 18:42:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-12 18:42:33 +0000 |
commit | f8af98286022f72157d84951b48fde5fb369ab29 (patch) | |
tree | 9c6f89ee5d11a63c74f5dd8d9a41476992a4b070 /test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp | |
parent | 6dc00f6e98a00bd1c332927c3e04918d7e8b0d4f (diff) |
Within the body of a lambda expression, decltype((x)) for an
id-expression 'x' will compute the type based on the assumption that
'x' will be captured, even if it isn't captured, per C++11
[expr.prim.lambda]p18. There are two related refactors that go into
implementing this:
1) Split out the check that determines whether we should capture a
particular variable reference, along with the computation of the
type of the field, from the actual act of capturing the
variable.
2) Always compute the result of decltype() within Sema, rather than
AST, because the decltype() computation is now context-sensitive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp index fdf6c53633..e7eb5af891 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p12.cpp @@ -65,11 +65,11 @@ void f1(int i) { // expected-note{{declared here}} void work(int n) { // expected-note{{declared here}} int m = n*n; int j = 40; // expected-note{{declared here}} - auto m3 = [this,m] { // expected-note 2{{lambda expression begins here}} + auto m3 = [this,m] { // expected-note 3{{lambda expression begins here}} auto m4 = [&,j] { // expected-error{{variable 'j' cannot be implicitly captured in a lambda with no capture-default specified}} int x = n; // expected-error{{variable 'n' cannot be implicitly captured in a lambda with no capture-default specified}} x += m; - x += i; // expected-error{{reference to local variable 'i' declared in enclosing function 'f1'}} + x += i; // expected-error{{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}} x += f; }; }; |