[Bug c++/82877] negative array index accepted in a pointer difference expression in constexpr context

johelegp at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Sep 12 19:01:48 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82877

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johelegp at gmail dot com

--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Up to GCC 10. Not since GCC 11.

Another example: https://godbolt.org/z/GW3rrejjq.
```C++
constexpr void f(int i) {
  (&i)[-1];
}
int main() {
  []() consteval {
    f(0);
  }();
}
```

Bug 89149 may be a duplicate of this.


More information about the Gcc-bugs mailing list