__LINE__
?Authors: Jens Gustedt
Date: 2025-06-18
Submitted against: C23
Status: Open
The introduction of digit separators in C23 seems to have overlooked
the case of the __LINE__
macro. The current text would allow them.
If it is possible that such digit separators occur the following code could have expansions that are invalid in compilation phase 7:
#define UNIQ_(L, ...) __VA_ARGS__ ## L
#define UNIQ(...) UNIQ_(__LINE__, __VA_ARGS__)
int UNIQ(special) = 78; callit(UNIQ(special));
In general in all implementations that I am aware of the last line would expand to something like:
int special50138 = 78; callit(special50138);
If the expansion would contain digit separators that would be
int special50'138 = 78; callit(special50'138);
which would be invalid in phase 7.
Forbid the use of digit separators in the expansion of __LINE__
.
Change the corresponding item in "6.10.10.2 Mandatory macros":
__LINE__
The presumed line number (within the current source file) of the current source line (an integer literal not containing digit separators).216)