diff options
Diffstat (limited to 'clang/test/Parser')
-rw-r--r-- | clang/test/Parser/cxx0x-lambda-expressions.cpp | 18 | ||||
-rw-r--r-- | clang/test/Parser/objcxx0x-lambda-expressions.mm | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx0x-lambda-expressions.cpp b/clang/test/Parser/cxx0x-lambda-expressions.cpp index 642c69a532e..d7dc7d3a473 100644 --- a/clang/test/Parser/cxx0x-lambda-expressions.cpp +++ b/clang/test/Parser/cxx0x-lambda-expressions.cpp @@ -48,4 +48,22 @@ class C { delete [] { return new int; } (); // expected-error{{expected expression}} delete [&] { return new int; } (); // ok, lambda } + + // We support init-captures in C++11 as an extension. + int z; + 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}} + + 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}} + } (); + } }; diff --git a/clang/test/Parser/objcxx0x-lambda-expressions.mm b/clang/test/Parser/objcxx0x-lambda-expressions.mm index fb90b16a971..94e47ccd3e0 100644 --- a/clang/test/Parser/objcxx0x-lambda-expressions.mm +++ b/clang/test/Parser/objcxx0x-lambda-expressions.mm @@ -17,6 +17,16 @@ class C { [foo,bar] () { return 3; }; [=,&foo] () {}; [this] () {}; + + [foo(bar)] () {}; // expected-error {{not supported}} + [foo = bar] () {}; // expected-error {{not supported}} + [foo{bar}] () {}; // expected-error {{not supported}} + [foo = {bar}] () {}; // expected-error {{not supported}} + + [foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} + + // FIXME: These are some appalling diagnostics. + [foo = bar baz]; // expected-error {{missing '['}} expected-warning 2{{receiver type 'int'}} expected-warning 2{{instance method '-baz'}} } }; |