https://issues.dlang.org/show_bug.cgi?id=22825
Issue ID: 22825
Summary: #line parsing doesn't follow the spec
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Grammar is:
---
SpecialTokenSequence:
# line IntegerLiteral Filespec(opt) EndOfLine
# line __LINE__ Filespec(opt) EndOfLine
---
Because newlines (EndOfLine) is part of the grammar, then any other newlines
found between `#` and `EndOfLine` should not be ignored when parsing them.
This does not apply to multi-line comments, and other such markers that are
consumed and ignored by the lexer.
So while this should be accepted as valid code
---
#line /*
multi-line comment
*/ 42
int var;
---
This should not compile, but currently does.
---
#line /*
multi-line comment
*/
42
int var;
---
(There are similarities in this to issue 22812 for importC)
--