http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58181
Bug ID: 58181 Summary: A bug in lambda expression Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fimbul77 at gmail dot com Following the code: #include <tuple> #include <cassert> int main() { assert(std::get<0>( []() { int x = 0; return std::forward_as_tuple([=]() -> int { return x; }); }() )() == 0); } The assertion fails in gcc.(but only gcc4.6.4 succeed it) But I think it must be success. The variable x in [=]() -> int { return x; } should not garbage. It may be a lambda expression bug. Wandbox http://melpon.org/wandbox/permlink/MRhUXl888hCZAQcx