[Bug preprocessor/20262] __LINE__ implementation flaky.

aaw at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Dec 16 16:38:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20262

Ollie Wild <aaw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aaw at gcc dot gnu.org

--- Comment #4 from Ollie Wild <aaw at gcc dot gnu.org> ---
We recently ran into this issue in a context where __LINE__ was being used to
produce goto labels inside a macro-wrapped block of code.  The code in question
compiled fine with Clang/LLVM but produced a compiler error with GCC.

I've read through the standard (in this case, C++11), and as I read it
"presumed source line" is used to allow for the possibility of modifying the
source line via #line directives (which it says immediately thereafter in a
footnote), not as general consent to be liberal with line numbering. 
Regardless, using the true physical line conforms to the principle of least
surprise.

Would anyone be opposed to revisiting this?



More information about the Gcc-bugs mailing list