https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109433
Bug ID: 109433
Summary: [12/13 Regression] ICE with -std=c++11 and static
constexpr array inside a template constexpr
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Note this is not exactly a dup of bug 109431 as it works in GCC 11.3.0.
Note also it ICEs with -std=c++14 in GCC 11.3.0 (which looks to be the same as
PR109431 ) but works with -std=c++11.
testcase:
```
struct RangeLimits
{
int low = 1;
};
template <int>
int parameterLimits(void)
{
static RangeLimits constexpr param_limits[ 2 ] = {};
auto const &limits = param_limits[ 1 ];
return 0;
}
auto s = parameterLimits<1>();
```
Maybe they are the same issue but I am not 100% sure as they regressed at
different times and produce different ICEs.
The ICE on the trunk:
<source>:10:55: internal compiler error: unexpected expression 'const
RangeLimits()' of kind cast_expr
10 | static RangeLimits constexpr param_limits[ 2 ] = {};
| ^