https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82877
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks we correctly reject the testcase starting with GCC 9.1 (r9-6136):
<source>:9:21: in 'constexpr' expansion of 'f()'
<source>:9:22: error: array subscript value '-1' is outside the bounds of array
type 'int [1]'
9 | constexpr int i = f ();
| ^
Starting with GCC 10.1, the diagnostic also points to the correct line:
source>:9:21: in 'constexpr' expansion of 'f()'
<source>:6:27: error: array subscript value '-1' is outside the bounds of array
type 'int [1]'
6 | return &s.a[0] - &s.a[-1]; // undefined, should be rejected
| ~~~~~~^