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

--- Comment #8 from Alisdair Meredith <alisdairm at me dot com> ---
(In reply to Andrew Pinski from comment #6)
> Why not do this:
> static_assert(X == 3 || X == 4);
> 
> There that works for both cases.

The code example was intended to the be smallest reproducible example that
shows the value changing.  The typical failure we see is unit tests for our
testing framework, validating the message coming from our testing assert macros
and similar.  We format the error message we expect to see with a value offset
from the current line, to verify that the message captured writing to the
console (which we redirect for comparison) is the same.

We now need to adjust those tests, and similar, to account for the __LINE__
number varying in some testing invocations - which is doable.  My concern is
how many other folks are waiting to upgrade to gcc 9 and stumble over the same
issue?  If it is a dark enough corner, then maybe none :)

If this were to revert to historical behavior for gcc 10, we would just skip
those particular formatting tests on gcc9, as we have enough test coverage with
other compilers to have confidence in the message we output, and when actual
tests fire in production, they will still point to a valid line for our test
asserts.

Reply via email to