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 | 81495f341d4a8a06a1d775c31562a37dc2f9c7fe (patch) | |
tree | 3b34fb85073dac1f4dfb7a241b0522b6c9db1114 /clang/test/SemaCXX/lambda-expressions.cpp | |
parent | d74dd49065ba4109b8b04209fd197d85857d4281 (diff) | |
download | bcm5719-llvm-81495f341d4a8a06a1d775c31562a37dc2f9c7fe.tar.gz bcm5719-llvm-81495f341d4a8a06a1d775c31562a37dc2f9c7fe.zip |
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.
llvm-svn: 150347
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r-- | clang/test/SemaCXX/lambda-expressions.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp index 1da57c6c726..afbf9a1fffc 100644 --- a/clang/test/SemaCXX/lambda-expressions.cpp +++ b/clang/test/SemaCXX/lambda-expressions.cpp @@ -72,7 +72,8 @@ namespace ImplicitCapture { int f[10]; // expected-note {{declared}} [&]() { return f[2]; }; - (void) ^{ return []() { return f[2]; }; }; // expected-error {{cannot refer to declaration with an array type inside block}} + (void) ^{ return []() { return f[2]; }; }; // expected-error {{variable 'f' cannot be implicitly captured in a lambda with no capture-default specified}} \ + // expected-note{{lambda expression begins here}} struct G { G(); G(G&); int a; }; // expected-note 6 {{not viable}} G g; |