https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82359
Bug ID: 82359
Summary: #line does not allow C++14 quotes in number
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: preprocessor
Assignee: unassigned at gcc dot gnu.org
Reporter: aschepler at gmail dot com
Target Milestone: ---
In C++14 and later, any integer literal may contain single quote characters
(aka apostrophe, ASCII 0x27). But the #line preprocessing directive does not
allow it.
For example,
#line 1'000
results in:
error: "1'000" after #line is not a positive integer
The relevant grammar is found in [cpp], [cpp.line], and [lex.fcon]:
control-line:
...
# line pp-tokens new-line
...
digit-sequence:
digit
digit-sequence '_opt digit
where a line directive after macro substitution must have one of the two forms
# line digit-sequence new-line
# line digit-sequence " s-char-sequence_opt " new-line
The #if directive seems to have no problems with quote characters in numbers,
though.