Remove the "unsupported" error for lambda expressions. It's annoying,

and rapidly becoming untrue.

llvm-svn: 150165
This commit is contained in:
Douglas Gregor 2012-02-09 08:26:42 +00:00
parent 291af2b7e6
commit 656bc62a73
15 changed files with 90 additions and 107 deletions

View File

@ -4099,7 +4099,6 @@ def err_throw_incomplete_ptr : Error<
def err_return_in_constructor_handler : Error< def err_return_in_constructor_handler : Error<
"return in the catch of a function try block of a constructor is illegal">; "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< def err_capture_more_than_once : Error<
"%0 can appear only once in a capture list">; "%0 can appear only once in a capture list">;
def err_reference_capture_with_reference_default : Error< def err_reference_capture_with_reference_default : Error<

View File

@ -379,7 +379,5 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc,
break; break;
} }
Diag(StartLoc, diag::err_lambda_unsupported);
return MaybeBindToTemporary(Lambda); return MaybeBindToTemporary(Lambda);
} }

View File

@ -7,7 +7,7 @@ void f() {
int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}} int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing function 'f'}}
int cc = c; int cc = c;
}; };
(void)[]() mutable { // expected-error {{not supported yet}} (void)[]() mutable {
int x = 3; // expected-note{{'x' declared here}} int x = 3; // expected-note{{'x' declared here}}
struct C { struct C {
int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}} int& x2 = x; // expected-error{{reference to local variable 'x' declared in enclosing lambda expression}}

View File

@ -2,9 +2,7 @@
void block_capture_errors() { void block_capture_errors() {
__block int var; // expected-note 2{{'var' declared here}} __block int var; // expected-note 2{{'var' declared here}}
(void)[var] { }; // expected-error{{__block variable 'var' cannot be captured in a lambda}} \ (void)[var] { }; // 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}} \ (void)[=] { var = 17; }; // expected-error{{__block variable 'var' cannot be captured in a lambda}}
// expected-error{{lambda expressions are not supported yet}}
} }

View File

@ -17,10 +17,9 @@ class X0 {
void explicit_capture() { void explicit_capture() {
int variable; // expected-note {{declared here}} int variable; // expected-note {{declared here}}
(void)[&Overload] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}} (void)[&Overload] () {}; // expected-error {{does not name a variable}}
(void)[&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}} (void)[&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}}
(void)[&AmbiguousVar] () {}; // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}} (void)[&AmbiguousVar] () {}; // expected-error {{reference to 'AmbiguousVar' is ambiguous}}
(void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}} \ (void)[&Variable] () {}; // expected-error {{use of undeclared identifier 'Variable'; did you mean 'variable'}}
// expected-error{{lambda expressions are not supported yet}}
} }
}; };

View File

@ -8,10 +8,8 @@ class NonCopyable {
void capture_by_copy(NonCopyable nc, NonCopyable &ncr) { void capture_by_copy(NonCopyable nc, NonCopyable &ncr) {
// FIXME: error messages should talk about capture // FIXME: error messages should talk about capture
(void)[nc] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \ (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}}
(void)[ncr] { }; // expected-error{{field of type 'NonCopyable' has private copy constructor}} \
// expected-error{{lambda expressions are not supported yet}}
} }
struct NonTrivial { struct NonTrivial {
@ -28,7 +26,7 @@ struct CopyCtorDefault {
}; };
void capture_with_default_args(CopyCtorDefault cct) { 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 { struct ExpectedArrayLayout {
@ -37,7 +35,7 @@ struct ExpectedArrayLayout {
void capture_array() { void capture_array() {
CopyCtorDefault array[3]; CopyCtorDefault array[3];
auto x = [=]() -> void { // expected-error{{lambda expressions are not supported yet}} auto x = [=]() -> void {
capture(array[0]); capture(array[0]);
}; };
static_assert(sizeof(x) == sizeof(ExpectedArrayLayout), "layout mismatch"); static_assert(sizeof(x) == sizeof(ExpectedArrayLayout), "layout mismatch");
@ -51,7 +49,7 @@ struct ExpectedLayout {
}; };
void test_layout(char a, short b) { void test_layout(char a, short b) {
auto x = [=] () -> void { // expected-error{{lambda expressions are not supported yet}} auto x = [=] () -> void {
capture(a); capture(a);
capture(b); capture(b);
}; };

View File

@ -6,7 +6,7 @@ class NonCopyable {
void capture_by_ref(NonCopyable nc, NonCopyable &ncr) { void capture_by_ref(NonCopyable nc, NonCopyable &ncr) {
int array[3]; int array[3];
(void)[&nc] () -> void {}; // expected-error{{lambda expressions are not supported yet}} (void)[&nc] () -> void {};
(void)[&ncr] () -> void {}; // expected-error{{lambda expressions are not supported yet}} (void)[&ncr] () -> void {};
(void)[&array] () -> void {}; // expected-error{{lambda expressions are not supported yet}} (void)[&array] () -> void {};
} }

View File

@ -2,9 +2,8 @@
// prvalue // prvalue
void prvalue() { void prvalue() {
auto&& x = []()->void { }; // expected-error{{lambda expressions are not supported yet}} auto&& x = []()->void { };
auto& y = []()->void { }; // expected-error{{cannot bind to a temporary of type}} \ auto& y = []()->void { }; // expected-error{{cannot bind to a temporary of type}}
// expected-error{{lambda expressions are not supported yet}}
} }
namespace std { namespace std {
@ -16,11 +15,9 @@ struct P {
}; };
void unevaluated_operand(P &p, int i) { void unevaluated_operand(P &p, int i) {
int i2 = sizeof([]()->void{}()); // expected-error{{lambda expression in an unevaluated operand}} \ 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; }());
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}}
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}}
} }
template<typename T> template<typename T>
@ -36,13 +33,10 @@ struct Boom {
void odr_used(P &p, Boom<int> boom_int, Boom<float> boom_float, void odr_used(P &p, Boom<int> boom_int, Boom<float> boom_float,
Boom<double> boom_double) { Boom<double> boom_double) {
const std::type_info &ti1 const std::type_info &ti1
= typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-error{{lambda expressions are not supported yet}} \ = typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}}
// expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}}
const std::type_info &ti2 const std::type_info &ti2
= typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} \ = 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}} // 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}} \ auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}}
// expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}}
} }

View File

@ -1,7 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
void test_nonaggregate(int i) { void test_nonaggregate(int i) {
auto lambda = [i]() -> void {}; // expected-error{{lambda expressions are not supported yet}} \ auto lambda = [i]() -> void {}; // expected-note 3{{candidate constructor}}
// expected-note 3{{candidate constructor}}
decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}} decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
} }

View File

@ -1,7 +1,6 @@
// RUN: %clang_cc1 -std=c++11 %s -verify // RUN: %clang_cc1 -std=c++11 %s -verify
int test_default_args() { int test_default_args() {
(void)[](int i = 5, // expected-error{{default arguments can only be specified for parameters in a function declaration}} \ (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}}
int j = 17) {}; // 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}}
} }

View File

@ -2,8 +2,7 @@
// Check that analysis-based warnings work in lambda bodies. // Check that analysis-based warnings work in lambda bodies.
void analysis_based_warnings() { void analysis_based_warnings() {
(void)[]() -> int { }; // expected-warning{{control reaches end of non-void function}} \ (void)[]() -> int { }; // expected-warning{{control reaches end of non-void function}}
// expected-error{{lambda expressions are not supported yet}}
} }
// Check that we get the right types of captured variables (the // 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&); float &check_const_int(const int&);
void test_capture_constness(int i, const int ic) { 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 &fr1 = check_const_int(i);
float &fr2 = check_const_int(ic); 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 &fr1 = check_const_int(i);
float &fr2 = check_const_int(ic); 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); int &ir = check_const_int(i);
float &fr = check_const_int(ic); 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); int &ir = check_const_int(i);
float &fr = check_const_int(ic); 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); int &ir = check_const_int(i);
float &fr = check_const_int(ic); float &fr = check_const_int(ic);
}; };
(void)[&] ()->void { // expected-error{{lambda expressions are not supported yet}} (void)[&] ()->void {
int &ir = check_const_int(i); int &ir = check_const_int(i);
float &fr = check_const_int(ic); float &fr = check_const_int(ic);
}; };

View File

@ -4,13 +4,13 @@ class X0 {
void explicit_capture() { void explicit_capture() {
int foo; int foo;
(void)[foo, foo] () {}; // expected-error {{'foo' can appear only once}} 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}} expected-error {{not supported yet}} (void)[this, this] () {}; // expected-error {{'this' can appear only once}}
(void)[=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}} (void)[=, foo] () {}; // expected-error {{'&' must precede a capture when}}
(void)[=, &foo] () {}; // expected-error {{not supported yet}} (void)[=, &foo] () {};
(void)[=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}} (void)[=, this] () {}; // expected-error {{'this' cannot appear}}
(void)[&, foo] () {}; // expected-error {{not supported yet}} (void)[&, foo] () {};
(void)[&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}} (void)[&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}}
(void)[&, this] () {}; // expected-error {{not supported yet}} (void)[&, this] () {};
} }
}; };

View File

@ -12,13 +12,13 @@ class C {
[&this] {}; // expected-error {{'this' cannot be captured by reference}} [&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 {{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 i) {};
[&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}} [&] (int) mutable -> void {};
[foo,bar] () { return 3; }; // expected-error {{lambda expressions are not supported yet}} [foo,bar] () { return 3; };
[=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}} [=,&foo] () {};
[&,foo] () {}; // expected-error {{lambda expressions are not supported yet}} [&,foo] () {};
[this] () {}; // expected-error {{lambda expressions are not supported yet}} [this] () {};
return 1; return 1;
} }

View File

@ -11,12 +11,12 @@ class C {
[]; // expected-error {{expected body of lambda expression}} []; // expected-error {{expected body of lambda expression}}
[=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}} [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
[&this] {}; // expected-error {{address expression must be an lvalue}} [&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 i) {};
[&] (int) mutable -> void {}; // expected-error {{lambda expressions are not supported yet}} [&] (int) mutable -> void {};
[foo,bar] () { return 3; }; // expected-error {{lambda expressions are not supported yet}} [foo,bar] () { return 3; };
[=,&foo] () {}; // expected-error {{lambda expressions are not supported yet}} [=,&foo] () {};
[this] () {}; // expected-error {{lambda expressions are not supported yet}} [this] () {};
} }
}; };

View File

@ -11,76 +11,76 @@ namespace ExplicitCapture {
virtual C& Overload(float); virtual C& Overload(float);
void ImplicitThisCapture() { void ImplicitThisCapture() {
[](){(void)Member;}; // 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;}; // expected-error {{not supported yet}} [&](){(void)Member;};
// 'this' captures below don't actually work yet
[this](){(void)Member;}; // expected-error{{lambda expressions are not supported yet}} [this](){(void)Member;};
[this]{[this]{};}; // expected-error 2{{lambda expressions are not supported yet}} [this]{[this]{};};
[]{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error 2 {{not supported yet}} []{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}}
[]{Overload(3);}; // expected-error {{not supported yet}} []{Overload(3);};
[]{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}} []{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}}
[]{(void)typeid(Overload());};// expected-error {{not supported yet}} []{(void)typeid(Overload());};
[]{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}} []{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}}
} }
}; };
void f() { 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 { namespace ReturnDeduction {
void test() { void test() {
[](){ return 1; }; // expected-error {{not supported yet}} [](){ return 1; };
[](){ return 1; }; // expected-error {{not supported yet}} [](){ return 1; };
[](){ return ({return 1; 1;}); }; // expected-error {{not supported yet}} [](){ return ({return 1; 1;}); };
[](){ return ({return 'c'; 1;}); }; // expected-error {{not supported yet}} expected-error {{must match previous return type}} [](){ return ({return 'c'; 1;}); }; // expected-error {{must match previous return type}}
[]()->int{ return 'c'; return 1; }; // expected-error {{not supported yet}} []()->int{ return 'c'; return 1; };
[](){ return 'c'; return 1; }; // expected-error {{not supported yet}} expected-error {{must match previous return type}} [](){ return 'c'; return 1; }; // expected-error {{must match previous return type}}
[]() { return; return (void)0; }; // expected-error {{not supported yet}} []() { return; return (void)0; };
// FIXME: Need to check structure of lambda body // FIXME: Need to check structure of lambda body
[](){ return 1; return 1; }; // expected-error {{not supported yet}} [](){ return 1; return 1; };
} }
} }
namespace ImplicitCapture { namespace ImplicitCapture {
void test() { void test() {
int a = 0; // expected-note 5 {{declared}} 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 {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{begins here}}
[&]() { return a; }; // expected-error {{not supported yet}} [&]() { return a; };
[=]() { return a; }; // expected-error {{not supported yet}} [=]() { return a; };
[=]() { int* b = &a; }; // expected-error {{cannot initialize a variable of type 'int *' with an rvalue of type 'const int *'}} expected-error {{not supported yet}} [=]() { int* b = &a; }; // expected-error {{cannot initialize a variable of type 'int *' with an rvalue of type 'const int *'}}
[=]() { return [&]() { return a; }; }; // expected-error 2 {{not supported yet}} [=]() { 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}} 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}}
[]() { 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 ^{ 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}} expected-error 2 {{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}}
[=]() { return [&a] { return a; }; }; // expected-error 2 {{not supported yet}} [=]() { return [&a] { return a; }; }; //
const int b = 2; const int b = 2;
[]() { return b; }; // expected-error {{not supported yet}} []() { return b; };
union { // expected-note {{declared}} union { // expected-note {{declared}}
int c; int c;
float d; float d;
}; };
d = 3; 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}} __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}} [&]() { 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}} expected-error {{not supported yet}} [&e]() { return e; }; // expected-error 2 {{__block variable 'e' cannot be captured in a lambda expression}}
int f[10]; // expected-note {{declared}} int f[10]; // expected-note {{declared}}
[&]() { return f[2]; }; // 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}} expected-error {{not supported yet}} (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}} struct G { G(); G(G&); int a; }; // expected-note 6 {{not viable}}
G g; G g;
[=]() { const G* gg = &g; return gg->a; }; // 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'}} expected-error 2 {{not supported yet}} [=]() { 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'}} expected-error {{not supported yet}} (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}} 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}}
} }
} }