https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113638
Bug ID: 113638
Summary: Array bounds of variable templates are not correctly
deduced from initializers since GCC13
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Keywords: accepts-invalid, rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: de34 at live dot cn
Target Milestone: ---
The following code snippet is incorrectly processed since C++13.
Godbolt link: https://godbolt.org/z/xjEqnqodj
```
#include <type_traits>
template<int ...Is>
constexpr int my_array[]{Is...};
static_assert(std::is_same_v<decltype(my_array<1, 2, 3, 4, 5>), const int[5]>);
// rejected since GCC13
static_assert(sizeof(my_array<1, 2, 3, 4, 5>) == sizeof(int) * 5); // rejected
since GCC13
static_assert(std::is_same_v<decltype(my_array<1, 2, 3, 4, 5>), const int[]>);
// passes since GCC13, but should not
```
It seems that GCC gives up deducing the array bounds from initializers of
variable templates since GCC13.