diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp | 24 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp | 16 | ||||
-rw-r--r-- | test/SemaCXX/lambda-expressions.cpp | 30 |
3 files changed, 43 insertions, 27 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp new file mode 100644 index 0000000000..497307ff75 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +int GlobalVar; // expected-note 2{{declared here}} + +namespace N { + int AmbiguousVar; // expected-note {{candidate}} +} +int AmbiguousVar; // expected-note {{candidate}} +using namespace N; + +class X0 { + int Member; + + static void Overload(int); + void Overload(); + virtual X0& Overload(float); + + void explicit_capture() { + [&Overload] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}} + [&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}} + [&AmbiguousVar] () {} // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}} + [&Globalvar] () {}; // expected-error {{use of undeclared identifier 'Globalvar'; did you mean 'GlobalVar}} + } +}; diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp new file mode 100644 index 0000000000..4bd5760bc4 --- /dev/null +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +class X0 { + void explicit_capture() { + int foo; + + [foo, foo] () {}; // expected-error {{'foo' can appear only once}} expected-error {{not supported yet}} + [this, this] () {}; // expected-error {{'this' can appear only once}} expected-error {{not supported yet}} + [=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}} + [=, &foo] () {}; // expected-error {{not supported yet}} + [=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}} + [&, foo] () {}; // expected-error {{not supported yet}} + [&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}} + [&, this] () {}; // expected-error {{not supported yet}} + } +}; diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index 0223b50755..cacd4b680c 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -3,14 +3,6 @@ namespace std { class type_info; }; namespace ExplicitCapture { - int GlobalVar; // expected-note {{declared here}} - - namespace N { - int AmbiguousVar; // expected-note {{candidate}} - } - int AmbiguousVar; // expected-note {{candidate}} - using namespace N; - class C { int Member; @@ -18,28 +10,12 @@ namespace ExplicitCapture { void Overload(); virtual C& Overload(float); - void ExplicitCapture() { - int foo; - - [foo, foo] () {}; // expected-error {{'foo' can appear only once}} expected-error {{not supported yet}} - [this, this] () {}; // expected-error {{'this' can appear only once}} expected-error {{not supported yet}} - [=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}} - [=, &foo] () {}; // expected-error {{not supported yet}} - [=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}} - [&, foo] () {}; // expected-error {{not supported yet}} - [&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}} - [&, this] () {}; // expected-error {{not supported yet}} - [&Overload] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}} - [&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}} - [&AmbiguousVar] () {} // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}} - [&Globalvar] () {}; // expected-error {{use of undeclared identifier 'Globalvar'; did you mean 'GlobalVar}} - } - void ImplicitThisCapture() { [](){(void)Member;}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}} [&](){(void)Member;}; // expected-error {{not supported yet}} - [this](){(void)Member;}; // expected-error {{not supported yet}} - [this]{[this]{};};// expected-error 2 {{not supported yet}} + // FIXME: 'this' captures below don't actually work yet + // FIXME: [this](){(void)Member;}; + // FIXME: [this]{[this]{};}; []{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error 2 {{not supported yet}} []{Overload(3);}; // expected-error {{not supported yet}} []{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}} |