Eli Friedman | e81d7e9 | 2012-01-07 01:08:17 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s |
| 2 | |
| 3 | namespace ExplicitCapture { |
| 4 | int GlobalVar; // expected-note {{declared here}} |
| 5 | |
| 6 | namespace N { |
| 7 | int AmbiguousVar; // expected-note {{candidate}} |
| 8 | } |
| 9 | int AmbiguousVar; // expected-note {{candidate}} |
| 10 | using namespace N; |
| 11 | |
| 12 | class C { |
| 13 | int x; |
| 14 | |
| 15 | void f(int); |
| 16 | void f() { |
| 17 | int foo; |
| 18 | |
| 19 | [foo, foo] () {}; // expected-error {{'foo' can appear only once}} expected-error {{not supported yet}} |
| 20 | [this, this] () {}; // expected-error {{'this' can appear only once}} expected-error {{not supported yet}} |
| 21 | [=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}} |
| 22 | [=, &foo] () {}; // expected-error {{not supported yet}} |
| 23 | [=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}} |
| 24 | [&, foo] () {}; // expected-error {{not supported yet}} |
| 25 | [&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}} |
| 26 | [&, this] () {}; // expected-error {{not supported yet}} |
| 27 | [&f] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}} |
| 28 | [&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}} |
| 29 | [&AmbiguousVar] () {} // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}} |
| 30 | [&Globalvar] () {}; // expected-error {{use of undeclared identifier 'Globalvar'; did you mean 'GlobalVar}} |
| 31 | } |
| 32 | }; |
| 33 | |
| 34 | void f() { |
| 35 | [this] () {}; // expected-error {{invalid use of 'this'}} expected-error {{not supported yet}} |
| 36 | } |
| 37 | } |