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

            Bug ID: 126060
           Summary: Invalid pointer subtraction is accepted in constant
                    expressions
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following code is incorrectly accepted by GCC:

int x[2][2];
static_assert(x[1]-x[0]==2);

This should be invalid, since x[1] and x[0] are not pointers to elements of the
same array object. Clang and MSVC reject this, though EDG accepts it as well.

Reply via email to