https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83268
Bug ID: 83268 Summary: internal compiler error: in lambda_expr_this_capture, at cp/lambda.c:785 Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zealot0630 at gmail dot com Target Milestone: --- The following C++14 file produces an internal compiler error. #include <functional> int t(std::function<void(int&&)>&&); struct X { int f(); int operator()() { return t([&](auto) -> void { [x = f()]{}(); }); } }; % g++ -std=c++14 -c bug.cpp bug.cpp: In instantiation of ‘struct X::operator()()::<lambda(auto:1)> [with auto:1 = int]::<lambda()>’: bug.cpp:9:15: required from ‘X::operator()()::<lambda(auto:1)> [with auto:1 = int]’ /usr/include/c++/7/bits/std_function.h:316:37: required from ‘static void std::_Function_handler<void(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes&& ...) [with _Functor = X::operator()()::<lambda(auto:1)>; _ArgTypes = {int&&}]’ /usr/include/c++/7/bits/std_function.h:694:19: required from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = X::operator()()::<lambda(auto:1)>; <template-parameter-2-2> = void; <template-parameter-2-3> = void; _Res = void; _ArgTypes = {int&&}]’ bug.cpp:10:4: required from here bug.cpp:9:10: internal compiler error: in lambda_expr_this_capture, at cp/lambda.c:785 [x = f()]{}(); ~^~ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.