https://bugs.llvm.org/show_bug.cgi?id=51844
Bug ID: 51844
Summary: The partial comment produced by deleting splice is
accepted by Clang
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++2a
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
Given the source file:
````
int main(){
}
//\
````
According to [lex.phases] p2
> Each sequence of a backslash character (\) immediately followed by zero or
> more whitespace characters other than new-line followed by a new-line
> character is deleted, splicing physical source lines to form logical source
> lines.
That means the source file will end with `/`, after the above phase. "//"
starts a comment and the comment is terminated by a new-line as per
[lex.comment] p1
> The characters // start a comment, which terminates immediately before the
> next new-line character.
According to [lex.phases] p3
> A source file shall not end in a partial preprocessing token or in a partial
> comment.
Since there is no new-line to terminate the comment, hence it is a partial
comment and the source file ends with that partial comment, the program should
be ill-formed.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs