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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-09-01

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is pointing to the whole expression and just the outermost operator, || .

Now the C++ front-end gives a better location and information on why it is not
a constant expression:
<source>: In function 'int main()':
<source>:11:26: error: non-constant condition for static assertion
   11 |         _Static_assert(0 || 7 > x, "");
      |                        ~~^~~~~~~~
<source>:11:33: error: the value of 'x' is not usable in a constant expression
   11 |         _Static_assert(0 || 7 > x, "");
      |                                 ^
<source>:9:13: note: 'int x' is not const
    9 |         int x = 42;
      |             ^


The C front-end could do better ...

Reply via email to