https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129125
Bug ID: 129125
Summary: ICE in write_unqualified_name, at cp/mangle.cc
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: s.kimura.h41104 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/cPx3d9rh5
Reproducer:
```
struct S {
union{
int :i;
};
};
template<auto p> void foo(){}
void bar() {
foo<S{42}>();
}
```
Backtrace:
<source>:3:10: error: 'i' was not declared in this scope
3 | int :i;
| ^
<source>: In function 'void bar()':
<source>:10:13: internal compiler error: tree check: expected tree that
contains 'decl with visibility' structure, have 'field_decl' in
write_unqualified_name, at cp/mangle.cc:1543
10 | foo<S{42}>();
| ~~~~~~~~~~^~
0x2d52c08 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2d4784b internal_error(char const*, ...)
???:0
0xacad9d tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0xd9e2e7 mangle_template_parm_object(tree_node*)
???:0
0xed3753 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
???:0
0xeef143 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0xc6341f build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xf2bbb2 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0xe86e73 c_parse_file()
???:0
0x101dd89 c_common_parse_file()
???:0
This ICE goes back to gcc-16