https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99833
Bug ID: 99833 Summary: structured binding + if init + generic lambda = internal compiler error Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickgray0 at brown dot edu Target Milestone: --- Build: -std=c++20 as the title suggests, the following code triggers an internal compiler error: #include <tuple> auto f(auto&& x) { [&](auto...) { auto y = std::tuple{ "what's happening here?", x }; if constexpr (auto [_, z] = y; requires { z; }) return; }(); } auto main()->int { f(42); } error message: <source>:6:36: internal compiler error: in tsubst_decomp_names, at cp/pt.c:18034 6 | if constexpr (auto [_, z] = y; requires { z; }) | ^~~~~~ 0x1cfb6a9 internal_error(char const*, ...) ???:0 0x6ba871 fancy_abort(char const*, int, char const*) ???:0 0x91c84f instantiate_decl(tree_node*, bool, bool) ???:0 0x7c6c0e maybe_instantiate_decl(tree_node*) ???:0 0x7c8370 mark_used(tree_node*, int) ???:0 0x6e2835 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x980ae5 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0x91c84f instantiate_decl(tree_node*, bool, bool) ???:0 0x7c6c0e maybe_instantiate_decl(tree_node*) ???:0 0x7c8370 mark_used(tree_node*, int) ???:0 0x6de097 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x980c6c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0x8e12ad c_parse_file() ???:0 0xa600a2 c_common_parse_file() ???:0 either moving the structured binding outside of if statement or making the lambda non-generic seems to solve the problem.