[Issue 22814] New: ImportC: C11 lexer deletes escaped new lines during translation
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 22 18:51:04 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22814
Issue ID: 22814
Summary: ImportC: C11 lexer deletes escaped new lines during
translation
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Following on from issue 22812, while new lines can't be ignored, they can
however be escaped.
>From C11 5.1.1.2-2:
---
Each instance of a backslash character ( \) immediately followed by a new-line
character is deleted, splicing physical source lines to form logical source
lines. Only the last backslash on any physical source line shall be eligible
for being part of such a splice. A source file that is not empty shall end in a
new-line character, which shall not be immediately preceded by a backslash
character before any such splicing takes place.
---
So whilst issue 22812 is an error, this should be accepted as valid:
---
# \
pragma \
pack \
( \
2 \
)
struct S
{
int i;
short j;
double k;
};
# \
pragma \
pack \
( \
)
---
--
More information about the Digitalmars-d-bugs
mailing list