https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113638
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-01-28
Status|UNCONFIRMED |NEW
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Simplified testcase:
```
template<int ...Is>
constexpr int my_array[]{Is...};
constexpr auto t1 = my_array<2>;
static_assert(sizeof(my_array<1>) == sizeof(int) * 1);
```
If we change the t1 variable definition to use `my_array<1>` instead of
`my_array<2>`, then the sizeof works.
It seems like we are not fully instantiating the template variable when used
inside a decltype/sizeof to figure out the array bounds.
An obvious workaround is to do:
```
template<int ...Is>
constexpr int my_array[sizeof...(Is)]{Is...};
```