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

            Bug ID: 94535
           Summary: __LINE__ value changed for macro invocations spanning
                    multiple lines
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alisdairm at me dot com
  Target Milestone: ---

Given the following simple program, the line that static_asserts changed from
gcc 8 to gcc 9 (and remains so for current trunk prior to 10's release):

#define LINE(DUMMY) __LINE__

constexpr int X = LINE(
                       wrap);

static_assert(X == 3); // gcc 8 and earlier, non-gcc compilers
static_assert(X == 4); // gcc 9 and 10

Note that every other compiler I have access to has the original gcc 8
behavior.
(tested widely with Godbolt compiler explorer, and on Solaris/AIX with native
compilers)

Unsurprisingly, this is breaking unit tests and other code similarly sensitive
to line numbers.

Godbolt link for quick testing: https://godbolt.org/z/LU--gC

Reply via email to