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

            Bug ID: 119567
           Summary: "unknown operator" in pointer subtraction diagnostic
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tbaeder at redhat dot com
  Target Milestone: ---

See: https://godbolt.org/z/fnPn844oY

constexpr int (*p1)[0] = 0, (*p2)[0] = 0;
constexpr int k2 = p2 - p1; 

prints:

<source>:4:23: error: arithmetic on pointer to an empty aggregate
    4 | constexpr int k2 = p2 - p1;
      |                    ~~~^~~~
<source>:4:23: error: '(0 <unknown operator> 0)' is not a constant expression

Not sure if the two 0s are correct either, but the "unknown operator" for a
subtraction seems very wrong.

Reply via email to