February 26, 2022 [Issue 22825] New: #line parsing doesn't follow the spec | ||||
|---|---|---|---|---|
| ||||
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: nobody@puremagic.com Reporter: ibuclaw@gdcproject.org 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) -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply