https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127721
Bug ID: 127721
Summary: ICE in invalid_tparm_referent_p, at cp/pt.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/hrETP3Mne
Reproducer:
```
static union {
int i;
};
template <int &> struct S {};
S<i> s;
```
Backtrace:
<source>:6:4: internal compiler error: in invalid_tparm_referent_p, at
cp/pt.cc:7572
6 | S<i> s;
| ^
0x2c734a8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2c680eb internal_error(char const*, ...)
???:0
0xb829cc fancy_abort(char const*, int, char const*)
???:0
0xe281e3 coerce_template_parms(tree_node*, tree_node*, tree_node*, int, bool)
???:0
0xe13a5a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int)
???:0
0xe7e62c finish_template_type(tree_node*, tree_node*, int)
???:0
0xddbcc3 c_parse_file()
???:0
0xf6f999 c_common_parse_file()
???:0
This ICE goes back to gcc-13.3:
https://godbolt.org/z/v3Pra4rq3