diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-09 08:26:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-09 08:26:42 +0000 |
commit | b326ca8ffbea96f9cc8a457b0f57be880304a6f5 (patch) | |
tree | 88d0757c9105ab4be5c68f44046cab11caa0ffd8 /test/CXX/expr/expr.prim/expr.prim.lambda | |
parent | 7e545d95bc92157f9f124d95aa2ed66d691d2028 (diff) |
Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.prim/expr.prim.lambda')
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp | 6 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp | 9 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp | 12 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp | 6 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp | 20 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp | 3 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp | 3 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp | 15 | ||||
-rw-r--r-- | test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp | 16 |
9 files changed, 38 insertions, 52 deletions
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp index 2ed738d3fd..ba2b70e4c3 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp @@ -2,9 +2,7 @@ void block_capture_errors() { __block int var; // expected-note 2{{'var' declared here}} - (void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} - (void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp index 6f09c53e57..b596bd5324 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp @@ -17,10 +17,9 @@ class X0 { void explicit_capture() { int variable; // expected-note {{declared here}} - (void)[&Overload] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}} - (void)[&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}} - (void)[&AmbiguousVar] () {}; // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}} - (void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[&Overload] () {}; // expected-error {{does not name a variable}} + (void)[&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} + (void)[&AmbiguousVar] () {}; // expected-error {{reference to 'AmbiguousVar' is ambiguous}} + (void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}} } }; diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp index 2dcaa5ddf6..ad603e1719 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp @@ -8,10 +8,8 @@ class NonCopyable { void capture_by_copy(NonCopyable nc, NonCopyable &ncr) { // FIXME: error messages should talk about capture - (void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ - // expected-error{{lambda expressions are not supported yet}} - (void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} + (void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} } struct NonTrivial { @@ -28,7 +26,7 @@ struct CopyCtorDefault { }; void capture_with_default_args(CopyCtorDefault cct) { - (void)[=] () -> void { cct.foo(); }; // expected-error{{lambda expressions are not supported yet}} + (void)[=] () -> void { cct.foo(); }; } struct ExpectedArrayLayout { @@ -37,7 +35,7 @@ struct ExpectedArrayLayout { void capture_array() { CopyCtorDefault array[3]; - auto x = [=]() -> void { // expected-error{{lambda expressions are not supported yet}} + auto x = [=]() -> void { capture(array[0]); }; static_assert(sizeof(x) == sizeof(ExpectedArrayLayout), "layout mismatch"); @@ -51,7 +49,7 @@ struct ExpectedLayout { }; void test_layout(char a, short b) { - auto x = [=] () -> void { // expected-error{{lambda expressions are not supported yet}} + auto x = [=] () -> void { capture(a); capture(b); }; diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp index 605265b80a..c4deba9c97 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp @@ -6,7 +6,7 @@ class NonCopyable { void capture_by_ref(NonCopyable nc, NonCopyable &ncr) { int array[3]; - (void)[&nc] () -> void {}; // expected-error{{lambda expressions are not supported yet}} - (void)[&ncr] () -> void {}; // expected-error{{lambda expressions are not supported yet}} - (void)[&array] () -> void {}; // expected-error{{lambda expressions are not supported yet}} + (void)[&nc] () -> void {}; + (void)[&ncr] () -> void {}; + (void)[&array] () -> void {}; } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp index 48c00aa7c6..c6ed308d79 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp @@ -2,9 +2,8 @@ // prvalue void prvalue() { - auto&& x = []()->void { }; // expected-error{{lambda expressions are not supported yet}} - auto& y = []()->void { }; // expected-error{{cannot bind to a temporary of type}} \ - // expected-error{{lambda expressions are not supported yet}} + auto&& x = []()->void { }; + auto& y = []()->void { }; // expected-error{{cannot bind to a temporary of type}} } namespace std { @@ -16,11 +15,9 @@ struct P { }; void unevaluated_operand(P &p, int i) { - int i2 = sizeof([]()->void{}()); // expected-error{{lambda expression in an unevaluated operand}} \ - // expected-error{{lambda expressions are not supported yet}} - const std::type_info &ti1 = typeid([&]() -> P& { return p; }()); // expected-error{{lambda expressions are not supported yet}} - const std::type_info &ti2 = typeid([&]() -> int { return i; }()); // expected-error{{lambda expression in an unevaluated operand}} \ - // expected-error{{lambda expressions are not supported yet}} + int i2 = sizeof([]()->void{}()); // expected-error{{lambda expression in an unevaluated operand}} + const std::type_info &ti1 = typeid([&]() -> P& { return p; }()); + const std::type_info &ti2 = typeid([&]() -> int { return i; }()); // expected-error{{lambda expression in an unevaluated operand}} } template<typename T> @@ -36,13 +33,10 @@ struct Boom { void odr_used(P &p, Boom<int> boom_int, Boom<float> boom_float, Boom<double> boom_double) { const std::type_info &ti1 - = typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-error{{lambda expressions are not supported yet}} \ - // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}} + = typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}} const std::type_info &ti2 = typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} \ - // expected-error{{lambda expressions are not supported yet}} \ // expected-note{{in instantiation of member function 'Boom<float>::Boom' requested here}} - auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-error{{lambda expressions are not supported yet}} \ - // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}} + auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}} } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp index 103f79d015..562f92a78b 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp @@ -1,7 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify void test_nonaggregate(int i) { - auto lambda = [i]() -> void {}; // expected-error{{lambda expressions are not supported yet}} \ - // expected-note 3{{candidate constructor}} + auto lambda = [i]() -> void {}; // expected-note 3{{candidate constructor}} decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}} } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp index 93ba6f61c7..ff6e7b4438 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp @@ -1,7 +1,6 @@ // RUN: %clang_cc1 -std=c++11 %s -verify int test_default_args() { - (void)[](int i = 5, // expected-error{{default arguments can only be specified for parameters in a function declaration}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[](int i = 5, // expected-error{{default arguments can only be specified for parameters in a function declaration}} int j = 17) {}; // expected-error{{default arguments can only be specified for parameters in a function declaration}} } diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp index e816426cbf..21c8e22092 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp @@ -2,8 +2,7 @@ // Check that analysis-based warnings work in lambda bodies. void analysis_based_warnings() { - (void)[]() -> int { }; // expected-warning{{control reaches end of non-void function}} \ - // expected-error{{lambda expressions are not supported yet}} + (void)[]() -> int { }; // expected-warning{{control reaches end of non-void function}} } // Check that we get the right types of captured variables (the @@ -12,32 +11,32 @@ int &check_const_int(int&); float &check_const_int(const int&); void test_capture_constness(int i, const int ic) { - (void)[i,ic] ()->void { // expected-error{{lambda expressions are not supported yet}} + (void)[i,ic] ()->void { float &fr1 = check_const_int(i); float &fr2 = check_const_int(ic); }; - (void)[=] ()->void { // expected-error{{lambda expressions are not supported yet}} + (void)[=] ()->void { float &fr1 = check_const_int(i); float &fr2 = check_const_int(ic); }; - (void)[i,ic] () mutable ->void { // expected-error{{lambda expressions are not supported yet}} + (void)[i,ic] () mutable ->void { int &ir = check_const_int(i); float &fr = check_const_int(ic); }; - (void)[=] () mutable ->void { // expected-error{{lambda expressions are not supported yet}} + (void)[=] () mutable ->void { int &ir = check_const_int(i); float &fr = check_const_int(ic); }; - (void)[&i,&ic] ()->void { // expected-error{{lambda expressions are not supported yet}} + (void)[&i,&ic] ()->void { int &ir = check_const_int(i); float &fr = check_const_int(ic); }; - (void)[&] ()->void { // expected-error{{lambda expressions are not supported yet}} + (void)[&] ()->void { int &ir = check_const_int(i); float &fr = check_const_int(ic); }; diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp index 53d2c75772..8f524e0824 100644 --- a/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp +++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp @@ -4,13 +4,13 @@ class X0 { void explicit_capture() { int foo; - (void)[foo, foo] () {}; // expected-error {{'foo' can appear only once}} expected-error {{not supported yet}} - (void)[this, this] () {}; // expected-error {{'this' can appear only once}} expected-error {{not supported yet}} - (void)[=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}} - (void)[=, &foo] () {}; // expected-error {{not supported yet}} - (void)[=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}} - (void)[&, foo] () {}; // expected-error {{not supported yet}} - (void)[&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}} - (void)[&, this] () {}; // expected-error {{not supported yet}} + (void)[foo, foo] () {}; // expected-error {{'foo' can appear only once}} + (void)[this, this] () {}; // expected-error {{'this' can appear only once}} + (void)[=, foo] () {}; // expected-error {{'&' must precede a capture when}} + (void)[=, &foo] () {}; + (void)[=, this] () {}; // expected-error {{'this' cannot appear}} + (void)[&, foo] () {}; + (void)[&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} + (void)[&, this] () {}; } }; |