https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122484
Bug ID: 122484
Summary: [13/14/15/16 regression] ICE on missing constexpr
(unexpected expression 'Deg' of kind
template_parm_index)
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
Created attachment 62672
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62672&action=edit
p.cxx
```
$ g++ p.cxx
p.cxx:11:57: internal compiler error: unexpected expression ‘Deg’ of kind
template_parm_index
11 | std::array<std::array<std::array<uint64_t, poly_size(Deg)>, 256>,
8>;
| ~~~~~~~~~^~~~~
0x7f5043a03706 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7f5043a037b5 __libc_start_main_impl
../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```
With 14 at least, we get a proper error then ICE:
```
$ g++-14 p.cxx
p.cxx:11:57: error: call to non-'constexpr' function 'size_t poly_size(size_t)'
11 | std::array<std::array<std::array<uint64_t, poly_size(Deg)>, 256>,
8>;
| ~~~~~~~~~^~~~~
p.cxx:5:8: note: 'size_t poly_size(size_t)' declared here
5 | size_t poly_size(size_t bits) {
| ^~~~~~~~~
p.cxx:11:57: internal compiler error: unexpected expression 'Deg' of kind
template_parm_index
11 | std::array<std::array<std::array<uint64_t, poly_size(Deg)>, 256>,
8>;
| ~~~~~~~~~^~~~~
```
With 15 and trunk, we just ICE.