diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-16 06:20:58 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-16 06:20:58 +0000 |
commit | ba71c085234044f8291b82749552a79d01f99631 (patch) | |
tree | ad88c0f301afad274d85c38231e034b26b8bd300 /clang/test/Parser/cxx0x-lambda-expressions.cpp | |
parent | ad9971d793e26c6d2ea28353f5b4dc6a2ee19833 (diff) | |
download | bcm5719-llvm-ba71c085234044f8291b82749552a79d01f99631.tar.gz bcm5719-llvm-ba71c085234044f8291b82749552a79d01f99631.zip |
First pass of semantic analysis for init-captures: check the initializer, build
a FieldDecl from it, and propagate both into the closure type and the
LambdaExpr.
You can't do much useful with them yet -- you can't use them within the body
of the lambda, because we don't have a representation for "the this of the
lambda, not the this of the enclosing context". We also don't have support or a
representation for a nested capture of an init-capture yet, which was intended
to work despite not being allowed by the current standard wording.
llvm-svn: 181985
Diffstat (limited to 'clang/test/Parser/cxx0x-lambda-expressions.cpp')
-rw-r--r-- | clang/test/Parser/cxx0x-lambda-expressions.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index d7dc7d3a473..76c1e0e7cec 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp @@ -54,16 +54,16 @@ class C { void init_capture() { // FIXME: These diagnostics should all disappear once semantic analysis // for init-captures is complete. - [n(0)] () -> int { return ++n; }; // expected-error {{not supported}} expected-error {{undeclared}} - [n{0}] { return; }; // expected-error {{not supported}} - [n = 0] { return ++n; }; // expected-error {{not supported}} expected-error {{undeclared}} - [n = {0}] { return; }; // expected-error {{not supported}} - [a([&b = z]{})](){}; // expected-error 2{{not supported}} + [n(0)] () -> int { return ++n; }; // expected-error {{non-static data member}} + [n{0}] { return; }; // expected-error {{<initializer_list>}} + [n = 0] { return ++n; }; // expected-error {{non-static data member}} + [n = {0}] { return; }; // expected-error {{<initializer_list>}} + [a([&b = z]{})](){}; - int x = 4; // expected-note {{here}} - auto y = [&r = x, x = x + 1]() -> int { // expected-error 2{{not supported}} expected-note {{here}} - r += 2; // expected-error {{undeclared}} - return x + 2; // expected-error {{implicitly captured}} + int x = 4; + auto y = [&r = x, x = x + 1]() -> int { + r += 2; // expected-error {{non-static data member}} + return x + 2; // expected-error {{non-static data member}} } (); } }; |