1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -Wno-c++1y-extensions -std=c++11 %s 2f4a2713aSLionel Sambuc 3f4a2713aSLionel Sambucclass C { 4f4a2713aSLionel Sambuc id get(int); 5f4a2713aSLionel Sambuc 6f4a2713aSLionel Sambuc void f() { 7f4a2713aSLionel Sambuc int foo, bar, baz; 8f4a2713aSLionel Sambuc 9f4a2713aSLionel Sambuc // fail to parse as a lambda introducer, so we get objc message parsing errors instead 10f4a2713aSLionel Sambuc [foo,+] {}; // expected-error {{expected expression}} 11f4a2713aSLionel Sambuc 12f4a2713aSLionel Sambuc []; // expected-error {{expected body of lambda expression}} 13f4a2713aSLionel Sambuc [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}} 14f4a2713aSLionel Sambuc [&this] {}; // expected-error {{cannot take the address of an rvalue of type 'C *'}} 15f4a2713aSLionel Sambuc [] {}; 16f4a2713aSLionel Sambuc [=] (int i) {}; 17f4a2713aSLionel Sambuc [&] (int) mutable -> void {}; 18f4a2713aSLionel Sambuc [foo,bar] () { return 3; }; 19f4a2713aSLionel Sambuc [=,&foo] () {}; 20f4a2713aSLionel Sambuc [this] () {}; 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc [foo(bar)] () {}; 23f4a2713aSLionel Sambuc [foo = bar] () {}; 24*0a6a1f1dSLionel Sambuc [foo{bar}] () {}; // expected-error {{<initializer_list>}} expected-warning {{will change meaning}} 25f4a2713aSLionel Sambuc [foo = {bar}] () {}; // expected-error {{<initializer_list>}} 26f4a2713aSLionel Sambuc 27f4a2713aSLionel Sambuc [foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} 28f4a2713aSLionel Sambuc [foo(bar), baz] () {}; // ok 29f4a2713aSLionel Sambuc 30f4a2713aSLionel Sambuc [foo = bar baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} 31f4a2713aSLionel Sambuc 32f4a2713aSLionel Sambuc [get(bar) baz]; // expected-warning {{instance method '-baz'}} 33f4a2713aSLionel Sambuc [get(bar), baz]; // expected-error {{expected body of lambda}} 34f4a2713aSLionel Sambuc 35f4a2713aSLionel Sambuc [foo = bar ++ baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} 36f4a2713aSLionel Sambuc [foo = bar + baz]; // expected-error {{expected body of lambda}} 37f4a2713aSLionel Sambuc [foo = { bar, baz }]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} 38f4a2713aSLionel Sambuc [foo = { bar } baz ]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}} 39f4a2713aSLionel Sambuc [foo = { bar }, baz ]; // expected-error {{<initializer_list>}} expected-error {{expected body of lambda}} 40f4a2713aSLionel Sambuc } 41f4a2713aSLionel Sambuc 42f4a2713aSLionel Sambuc}; 43f4a2713aSLionel Sambuc 44