blob: d100e2e48808dc98fe1ec08603f5f1b33f59d1c6 [file] [log] [blame]
Douglas Gregorae7902c2011-08-04 15:30:47 +00001// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
2
3class C {
4
5 void f() {
6 int foo, bar;
7
8 // fail to parse as a lambda introducer, so we get objc message parsing errors instead
9 [foo,+] {}; // expected-error {{expected expression}}
10
11 []; // expected-error {{expected body of lambda expression}}
12 [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
13 [&this] {}; // expected-error {{address expression must be an lvalue}}
14 [] {};
15 [=] (int i) {};
16 [&] (int) mutable -> void {};
17 // FIXME: this error occurs because we do not yet handle lambda scopes
18 // properly. I did not anticipate it because I thought it was a semantic (not
19 // syntactic) check.
20 [foo,bar] () { return 3; }; // expected-error {{void function 'f' should not return a value}}
21 [=,&foo] () {};
22 [this] () {};
23 }
24
25};
26