summaryrefslogtreecommitdiff
path: root/clang/test/Parser/objcxx0x-lambda-expressions.mm
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Parser/objcxx0x-lambda-expressions.mm')
-rw-r--r--clang/test/Parser/objcxx0x-lambda-expressions.mm23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Parser/objcxx0x-lambda-expressions.mm b/clang/test/Parser/objcxx0x-lambda-expressions.mm
new file mode 100644
index 0000000..1eab15b
--- /dev/null
+++ b/clang/test/Parser/objcxx0x-lambda-expressions.mm
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++11 %s
+
+class C {
+
+ void f() {
+ int foo, bar;
+
+ // fail to parse as a lambda introducer, so we get objc message parsing errors instead
+ [foo,+] {}; // expected-error {{expected expression}}
+
+ []; // expected-error {{expected body of lambda expression}}
+ [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
+ [&this] {}; // expected-error {{address expression must be an lvalue}}
+ [] {};
+ [=] (int i) {};
+ [&] (int) mutable -> void {};
+ [foo,bar] () { return 3; };
+ [=,&foo] () {};
+ [this] () {};
+ }
+
+};
+