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)
To be clearer, this compiles, probably shouldn't. --- # line 12 void main() { } ---
@ibuclaw created dlang/dmd pull request #13727 "fix Issue 22825 - #line parsing doesn't follow the spec" fixing this issue: - fix Issue 22825 - #line parsing doesn't follow the spec https://github.com/dlang/dmd/pull/13727
@ibuclaw created dlang/dlang.org pull request #3234 "Issue 22825: First newline terminates special token sequences" mentioning this issue: - Issue 22825: First newline terminates special token sequences https://github.com/dlang/dlang.org/pull/3234
dlang/dlang.org pull request #3234 "Issue 22825: First newline terminates special token sequences" was merged into master: - 92b9536d6307d3f48fd5634e3dc870ec63f8ed16 by Iain Buclaw: Issue 22825: First newline terminates special token sequences https://github.com/dlang/dlang.org/pull/3234
Fix was merged.
Spec was merged, not the bug fix.
@ibuclaw updated dlang/dmd pull request #13728 "fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive" fixing this issue: - fix Issue 22825 - #line parsing doesn't follow the spec https://github.com/dlang/dmd/pull/13728
dlang/dmd pull request #13728 "fix Issue 22812 - ImportC: C11 does not allow newlines between the start and end of a directive" was merged into master: - dd708f0925e8daa70483422105201b5f02ee9829 by Iain Buclaw: fix Issue 22825 - #line parsing doesn't follow the spec https://github.com/dlang/dmd/pull/13728