https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108566
Bug ID: 108566 Summary: [11/12/13 Regression] ICE: tree check: expected tree that contains 'decl with visibility' structure, have 'field_decl' in write_unqualified_name, at cp/mangle.cc:1438 Product: gcc Version: 13.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- gcc 13.0.1 20230122 snapshot (g:844eab81da3f49da88e8bb02e2b1255ba88d02b0) ICEs when compiling the following testcase, extracted from test/CodeGenCXX/mangle-nttp-anon-union.cpp from the clang 15 test suite, w/ -std=c++20: template<typename T> struct wrapper1 { union { struct { T RightName; }; }; }; template<auto tparam> void dummy(){} void uses() { dummy<wrapper1<double>{123.0}>(); } % g++-13 -std=c++20 -c h6lcbgyp.cpp h6lcbgyp.cpp: In function 'void uses()': h6lcbgyp.cpp:13:33: internal compiler error: tree check: expected tree that contains 'decl with visibility' structure, have 'field_decl' in write_unqualified_name, at cp/mangle.cc:1438 13 | dummy<wrapper1<double>{123.0}>(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 0x894b25 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/tree.cc:9028 0x700b5b contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/tree.h:3644 0x700b5b write_unqualified_name /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/mangle.cc:1438 0xa7b3b5 write_expression /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/mangle.cc:3424 0xa7b373 write_expression /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/mangle.cc:3430 0xa7e18a mangle_template_parm_object(tree_node*) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/mangle.cc:4607 0xb6b6af create_template_parm_object /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/pt.cc:7227 0xb6b6af convert_nontype_argument /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/pt.cc:7734 0xb6b6af convert_template_argument /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/pt.cc:8659 0xb6c402 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/pt.cc:9151 0xb8bbc5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/pt.cc:22255 0x96c4a4 add_template_candidate_real /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:3593 0x96d6b6 add_template_candidate /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:3681 0x96d6b6 add_candidates /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:6593 0x976811 add_candidates /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:4891 0x976811 perform_overload_resolution /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:4908 0x97b0c2 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/call.cc:5015 0xbae6da finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/semantics.cc:2923 0xb08fa8 cp_parser_postfix_expression /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/parser.cc:7957 0xaf02e4 cp_parser_binary_expression /var/tmp/portage/sys-devel/gcc-13.0.1_p20230122/work/gcc-13-20230122/gcc/cp/parser.cc:10101