Douglas Gregor | dcffcbf | 2012-02-09 01:26:17 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++11 %s |
Douglas Gregor | ae7902c | 2011-08-04 15:30:47 +0000 | [diff] [blame] | 2 | |
| 3 | class 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}} |
Richard Smith | 3fa3fea | 2013-02-02 02:14:45 +0000 | [diff] [blame] | 13 | [&this] {}; // expected-error {{cannot take the address of an rvalue of type 'C *'}} |
Douglas Gregor | b326ca8 | 2012-02-09 08:26:42 +0000 | [diff] [blame] | 14 | [] {}; |
| 15 | [=] (int i) {}; |
| 16 | [&] (int) mutable -> void {}; |
| 17 | [foo,bar] () { return 3; }; |
| 18 | [=,&foo] () {}; |
| 19 | [this] () {}; |
Richard Smith | 0a664b8 | 2013-05-09 21:36:41 +0000 | [diff] [blame] | 20 | |
Richard Smith | 0d8e964 | 2013-05-16 06:20:58 +0000 | [diff] [blame] | 21 | [foo(bar)] () {}; |
| 22 | [foo = bar] () {}; |
| 23 | [foo{bar}] () {}; // expected-error {{<initializer_list>}} |
| 24 | [foo = {bar}] () {}; // expected-error {{<initializer_list>}} |
Richard Smith | 0a664b8 | 2013-05-09 21:36:41 +0000 | [diff] [blame] | 25 | |
| 26 | [foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} |
| 27 | |
| 28 | // FIXME: These are some appalling diagnostics. |
| 29 | [foo = bar baz]; // expected-error {{missing '['}} expected-warning 2{{receiver type 'int'}} expected-warning 2{{instance method '-baz'}} |
Douglas Gregor | ae7902c | 2011-08-04 15:30:47 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | }; |
| 33 | |