https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120127
Bug ID: 120127 Summary: ICE in GCC when calling destructor of undefined type name in lambda (lookup_template_class crash) 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: --- ICE on this code: ``` #include <iostream> struct Bomb{ }; int main(){ [[maybe_unused]] auto test = []( auto t){ return [t = std::move(t)](){t.~T();}; }; Bomb b; auto test_with_bomb = test(std::move(b)); } ``` Stack dump ``` <source>:6:39: internal compiler error: in lookup_template_class, at cp/pt.cc:10406 6 | return [t = std::move(t)](){t.~T();}; | ^~ 0x2287465 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x22989b6 internal_error(char const*, ...) ???:0 0x7d443e fancy_abort(char const*, int, char const*) ???:0 0x9ab456 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x9ab9bc tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x9abc1c tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x9b8831 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0x99f62f instantiate_decl(tree_node*, bool, bool) ???:0 0x894821 maybe_instantiate_decl(tree_node*) ???:0 0x895b67 mark_used(tree_node*, int) ???:0 0x806f93 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x9d8b67 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ???:0 0x981ebd c_parse_file() ???:0 0xa8b739 c_common_parse_file() ???:0 ``` To quickly reproduce, it happens in all version since 12.1, including 15.1 and trunk https://gcc.godbolt.org/z/rfs8qPMWv