[cfe-commits] r150165 - in /cfe/trunk: include/clang/Basic/ lib/Sema/ test/CXX/class/class.local/ test/CXX/expr/expr.prim/expr.prim.lambda/ test/Parser/ test/SemaCXX/

Douglas Gregor dgregor at apple.com
Thu Feb 9 00:26:42 PST 2012


Author: dgregor
Date: Thu Feb  9 02:26:42 2012
New Revision: 150165

URL: http://llvm.org/viewvc/llvm-project?rev=150165&view=rev
Log:
Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaLambda.cpp
    cfe/trunk/test/CXX/class/class.local/p1-0x.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
    cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp
    cfe/trunk/test/Parser/objcxx0x-lambda-expressions.mm
    cfe/trunk/test/SemaCXX/lambda-expressions.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb  9 02:26:42 2012
@@ -4099,7 +4099,6 @@
 def err_return_in_constructor_handler : Error<
   "return in the catch of a function try block of a constructor is illegal">;
 
-def err_lambda_unsupported : Error<"lambda expressions are not supported yet">;
 def err_capture_more_than_once : Error<
   "%0 can appear only once in a capture list">;
 def err_reference_capture_with_reference_default : Error<

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Thu Feb  9 02:26:42 2012
@@ -379,7 +379,5 @@
     break;
   }
 
-  Diag(StartLoc, diag::err_lambda_unsupported);
-
   return MaybeBindToTemporary(Lambda);
 }

Modified: cfe/trunk/test/CXX/class/class.local/p1-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.local/p1-0x.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.local/p1-0x.cpp (original)
+++ cfe/trunk/test/CXX/class/class.local/p1-0x.cpp Thu Feb  9 02:26:42 2012
@@ -7,7 +7,7 @@
     int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}
     int cc = c;
   };
-  (void)[]() mutable { // expected-error {{not supported yet}}
+  (void)[]() mutable {
     int x = 3; // expected-note{{'x' declared here}}
     struct C {
       int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}}

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/blocks.cpp Thu Feb  9 02:26:42 2012
@@ -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}}
 }

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p10.cpp Thu Feb  9 02:26:42 2012
@@ -17,10 +17,9 @@
 
   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'}}
   }
 };

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p14.cpp Thu Feb  9 02:26:42 2012
@@ -8,10 +8,8 @@
 
 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 @@
 };
 
 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 @@
 
 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 @@
 };
 
 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);
   };

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p15.cpp Thu Feb  9 02:26:42 2012
@@ -6,7 +6,7 @@
 
 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 {};
 }

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp Thu Feb  9 02:26:42 2012
@@ -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 @@
 };
 
 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 @@
 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}}
 }

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp Thu Feb  9 02:26:42 2012
@@ -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}}
 }

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp Thu Feb  9 02:26:42 2012
@@ -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}}
 }

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp Thu Feb  9 02:26:42 2012
@@ -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 @@
 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);
   };

Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp Thu Feb  9 02:26:42 2012
@@ -4,13 +4,13 @@
   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] () {};
   }
 };

Modified: cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-lambda-expressions.cpp Thu Feb  9 02:26:42 2012
@@ -12,13 +12,13 @@
     [&this] {}; // expected-error {{'this' cannot be captured by reference}}
     [&,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
     [=,] {}; // expected-error {{expected variable name or 'this' in lambda capture list}}
-    [] {}; // expected-error {{lambda expressions are not supported yet}}
-    [=] (int i) {}; // expected-error {{lambda expressions are not supported yet}}
-    [&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}}
-    [foo,bar] () { return 3; }; // expected-error {{lambda expressions are not supported yet}}
-    [=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}}
-    [&,foo] () {}; // expected-error {{lambda expressions are not supported yet}}
-    [this] () {}; // expected-error {{lambda expressions are not supported yet}}
+    [] {}; 
+    [=] (int i) {}; 
+    [&] (int) mutable -> void {}; 
+    [foo,bar] () { return 3; }; 
+    [=,&foo] () {}; 
+    [&,foo] () {}; 
+    [this] () {}; 
 
     return 1;
   }

Modified: cfe/trunk/test/Parser/objcxx0x-lambda-expressions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objcxx0x-lambda-expressions.mm?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objcxx0x-lambda-expressions.mm (original)
+++ cfe/trunk/test/Parser/objcxx0x-lambda-expressions.mm Thu Feb  9 02:26:42 2012
@@ -11,12 +11,12 @@
     []; // 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}}
-    [] {}; // expected-error {{lambda expressions are not supported yet}}
-    [=] (int i) {}; // expected-error {{lambda expressions are not supported yet}}
-    [&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}}
-    [foo,bar] () { return 3; }; // expected-error {{lambda expressions are not supported yet}}
-    [=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}}
-    [this] () {}; // expected-error {{lambda expressions are not supported yet}}
+    [] {}; 
+    [=] (int i) {}; 
+    [&] (int) mutable -> void {}; 
+    [foo,bar] () { return 3; }; 
+    [=,&foo] () {}; 
+    [this] () {}; 
   }
 
 };

Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=150165&r1=150164&r2=150165&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Thu Feb  9 02:26:42 2012
@@ -11,76 +11,76 @@
     virtual C& Overload(float);
 
     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' captures below don't actually work yet
-      [this](){(void)Member;}; // expected-error{{lambda expressions are not supported yet}}
-      [this]{[this]{};}; // expected-error 2{{lambda expressions are not supported yet}}
-      []{[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}}
-      []{(void)typeid(Overload());};// expected-error {{not supported yet}}
-      []{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
+      [](){(void)Member;}; // expected-error {{'this' cannot be implicitly captured in this context}}
+      [&](){(void)Member;};
+
+      [this](){(void)Member;};
+      [this]{[this]{};};
+      []{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}}
+      []{Overload(3);}; 
+      []{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} 
+      []{(void)typeid(Overload());};
+      []{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}} 
     }
   };
 
   void f() {
-    [this] () {}; // expected-error {{'this' cannot be captured in this context}} expected-error {{not supported yet}}
+    [this] () {}; // expected-error {{'this' cannot be captured in this context}} 
   }
 }
 
 namespace ReturnDeduction {
   void test() {
-    [](){ return 1; }; // expected-error {{not supported yet}}
-    [](){ return 1; }; // expected-error {{not supported yet}}
-    [](){ return ({return 1; 1;}); }; // expected-error {{not supported yet}}
-    [](){ return ({return 'c'; 1;}); }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
-    []()->int{ return 'c'; return 1; }; // expected-error {{not supported yet}}
-    [](){ return 'c'; return 1; }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
-    []() { return; return (void)0; }; // expected-error {{not supported yet}}
+    [](){ return 1; }; 
+    [](){ return 1; }; 
+    [](){ return ({return 1; 1;}); }; 
+    [](){ return ({return 'c'; 1;}); }; // expected-error {{must match previous return type}}
+    []()->int{ return 'c'; return 1; }; 
+    [](){ return 'c'; return 1; };  // expected-error {{must match previous return type}}
+    []() { return; return (void)0; }; 
     // FIXME: Need to check structure of lambda body 
-    [](){ return 1; return 1; }; // expected-error {{not supported yet}}
+    [](){ return 1; return 1; }; 
   }
 }
 
 namespace ImplicitCapture {
   void test() {
     int a = 0; // expected-note 5 {{declared}}
-    []() { return a; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{begins here}} expected-error {{not supported yet}} 
-    [&]() { return a; }; // expected-error {{not supported yet}}
-    [=]() { return a; }; // expected-error {{not supported yet}}
-    [=]() { int* b = &a; }; // expected-error {{cannot initialize a variable of type 'int *' with an rvalue of type 'const int *'}} expected-error {{not supported yet}}
-    [=]() { return [&]() { return a; }; }; // expected-error 2 {{not supported yet}}
-    []() { return [&]() { return a; }; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error 2 {{not supported yet}}
-    []() { return ^{ return a; }; };// expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error {{not supported yet}}
-    []() { return [&a] { return a; }; }; // expected-error 2 {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note 2 {{lambda expression begins here}} expected-error 2 {{not supported yet}}
-    [=]() { return [&a] { return a; }; }; // expected-error 2 {{not supported yet}}
+    []() { return a; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{begins here}}  
+    [&]() { return a; }; 
+    [=]() { return a; }; 
+    [=]() { int* b = &a; }; // expected-error {{cannot initialize a variable of type 'int *' with an rvalue of type 'const int *'}} 
+    [=]() { return [&]() { return a; }; };
+    []() { return [&]() { return a; }; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} 
+    []() { return ^{ return a; }; };// expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} 
+    []() { return [&a] { return a; }; }; // expected-error 2 {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note 2 {{lambda expression begins here}} 
+    [=]() { return [&a] { return a; }; }; // 
 
     const int b = 2;
-    []() { return b; }; // expected-error {{not supported yet}}
+    []() { return b; }; 
 
     union { // expected-note {{declared}}
       int c;
       float d;
     };
     d = 3;
-    [=]() { return c; }; // expected-error {{unnamed variable cannot be implicitly captured in a lambda expression}} expected-error {{not supported yet}}
+    [=]() { return c; }; // expected-error {{unnamed variable cannot be implicitly captured in a lambda expression}} 
 
     __block int e; // expected-note 3 {{declared}}
-    [&]() { return e; }; // expected-error {{__block variable 'e' cannot be captured in a lambda expression}} expected-error {{not supported yet}}
-    [&e]() { return e; }; // expected-error 2 {{__block variable 'e' cannot be captured in a lambda expression}} expected-error {{not supported yet}}
+    [&]() { return e; }; // expected-error {{__block variable 'e' cannot be captured in a lambda expression}} 
+    [&e]() { return e; }; // expected-error 2 {{__block variable 'e' cannot be captured in a lambda expression}} 
 
     int f[10]; // expected-note {{declared}}
-    [&]() { return f[2]; };  // expected-error {{not supported yet}}
-    (void) ^{ return []() { return f[2]; }; }; // expected-error {{cannot refer to declaration with an array type inside block}} expected-error {{not supported yet}}
+    [&]() { return f[2]; };  
+    (void) ^{ return []() { return f[2]; }; }; // expected-error {{cannot refer to declaration with an array type inside block}} 
 
     struct G { G(); G(G&); int a; }; // expected-note 6 {{not viable}}
     G g;
-    [=]() { const G* gg = &g; return gg->a; }; // expected-error {{not supported yet}}
-    [=]() { return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error {{no matching constructor for initialization of 'const ImplicitCapture::G'}} expected-error 2 {{not supported yet}}
-    (void)^{ return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error 2 {{no matching constructor for initialization of 'const ImplicitCapture::G'}} expected-error {{not supported yet}}
+    [=]() { const G* gg = &g; return gg->a; }; 
+    [=]() { return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error {{no matching constructor for initialization of 'const ImplicitCapture::G'}} 
+    (void)^{ return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error 2 {{no matching constructor for initialization of 'const ImplicitCapture::G'}} 
 
     const int h = a; // expected-note {{declared}}
-    []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error {{not supported yet}}
+    []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} 
   }
 }





More information about the cfe-commits mailing list