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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=20262,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=61817
         Resolution|---                         |INVALID

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Although using the __LINE__ macro in multiple arguments in a macro invocation
is fine (i.e., allowed by the language), what each expands to when the macro
invocation spans multiple lines isn't precisely enough specified to expect one
kind of output or the other from the test case.  Bug 61817 contains fairly
extensive background on this question, including a reference to a paper
submitted to the C committee on the subject.  Rather than tightening up the
standard the committee decided to simply acknowledge that the behavior in these
cases is unspecified.  That said, I believe the GCC behavior reflects the
description in bug 61817 comment #3 (see the test committed along with the fix
for the bug).

As an aside, one of the reasons the C committee decided not to specify the
exact behavior was that different compilers have historically behaved
differently.  For example, while Clang prints 7 8 and GCC (and Microsoft Visual
C++) 9 9, IBM XLC prints 8 8.

With that, while I agree that in this case the expected behavior makes sense,
I'm going to resolve this report as invalid.

Reply via email to