https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120291
Bug ID: 120291 Summary: internal compiler error: in tsubst_pack_expansion, at cp/pt.cc:13941 with -std=c++20 Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mario.rodriguezb1 at um dot es Target Milestone: --- It ICEs in invalid this invalid code: ``` #include <iostream> template<int x> decltype(auto) f() { return [](auto... args) mutable requires requires { A<args...}; }{ [](auto... ){ A<1> a; }(...); }; } int main() { f<0>()(A<0>{}); } ``` Stack dump ``` <source>:3:9: internal compiler error: in tsubst_pack_expansion, at cp/pt.cc:13941 3 | return [](auto... args) mutable requires requires { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | A<args...}; | ~~~~~~~~~~ 0x2943505 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x2961276 internal_error(char const*, ...) ???:0 0xad8a2c fancy_abort(char const*, int, char const*) ???:0 0xd3430b tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd4f780 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0xd2772d instantiate_decl(tree_node*, bool, bool) ???:0 0xbe0833 maybe_instantiate_decl(tree_node*) ???:0 0xbe2527 mark_used(tree_node*, int) ???:0 0xb1020e build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0xd7dc7c finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0xcfcda3 c_parse_file() ???:0 0xe5f7c9 c_common_parse_file() ???:0 ``` To quickly reproduce with -std=c++20: https://godbolt.org/z/73r594779