https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126811
Bug ID: 126811
Summary: [14/15/16/17 Regression] c++: ICE in tsubst when a
constexpr init contains an NSDMI
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iains at gcc dot gnu.org
Target Milestone: ---
struct S { double m = 1; };
template<class T> void g() { constexpr S s = {}; (void) s; }
(shows on some release branches with -fchecking, however, that might be
misleading some interaction between the branch build conditions)
-std=c++20 -fchecking -fsyntax-only
(probably -std=c++14 is sufficient to make the class init an aggregate).
Looking at the code, it seems that the substitution was never expecting this -
the NSDMI legitimately contains a FLOAT_EXPR and tsubst has no case for it.
The question is whether tsubst should grow handling for that (and other
similar) cases - or whether the callers need adjustment...
====
<source>:2:47: internal compiler error: in tsubst_expr, at cp/pt.cc:23634
2 | template<class T> void g() { constexpr S s = {}; (void) s; }
| ^
0x2bae358 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2ba2f9b internal_error(char const*, ...)
???:0
0xb427ee fancy_abort(char const*, int, char const*)
???:0
0xea8d87 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
???:0
0xc541c2 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int,
cp_decomp*)
???:0
0xd98493 c_parse_file()
???:0
0xf2b969 c_common_parse_file()
???:0