diff options
Diffstat (limited to 'test/Parser/objcxx0x-lambda-expressions.mm')
-rw-r--r-- | test/Parser/objcxx0x-lambda-expressions.mm | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/test/Parser/objcxx0x-lambda-expressions.mm b/test/Parser/objcxx0x-lambda-expressions.mm index fb90b16..bef576a 100644 --- a/test/Parser/objcxx0x-lambda-expressions.mm +++ b/test/Parser/objcxx0x-lambda-expressions.mm @@ -1,9 +1,10 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++11 %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -Wno-c++1y-extensions -std=c++11 %s class C { + id get(int); void f() { - int foo, bar; + int foo, bar, baz; // fail to parse as a lambda introducer, so we get objc message parsing errors instead [foo,+] {}; // expected-error {{expected expression}} @@ -17,6 +18,25 @@ class C { [foo,bar] () { return 3; }; [=,&foo] () {}; [this] () {}; + + [foo(bar)] () {}; + [foo = bar] () {}; + [foo{bar}] () {}; // expected-error {{<initializer_list>}} + [foo = {bar}] () {}; // expected-error {{<initializer_list>}} + + [foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} + [foo(bar), baz] () {}; // ok + + [foo = bar baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + + [get(bar) baz]; // expected-warning {{instance method '-baz'}} + [get(bar), baz]; // expected-error {{expected body of lambda}} + + [foo = bar ++ baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + [foo = bar + baz]; // expected-error {{expected body of lambda}} + [foo = { bar, baz }]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} + [foo = { bar } baz ]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} + [foo = { bar }, baz ]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} } }; |