-
Notifications
You must be signed in to change notification settings - Fork 266
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
`"//" "/*" symbols inside string literals treated as comment start and break compilation, like shadowing closing }
For // it happens inside { block }
To Reproduce
https://cpp2.godbolt.org/z/5KEPj196s
Uncomment lines marked as error
main: () = {
std::cout << "//123"; //123, ok
//{ std::cout << "//456"; } //error
:()->_ = "//Ok";
//:()->_ = { return "//Error"; }
a:="*/ ok";
{ c:="*/ ok"; }
//b:="/* error even without {} block";
}
//error: (x) = { return "//"; }
Version
latest
Command lines
cppfront/cppfront $1.cpp2 -p
clang++-15 -Icppfront/include $1.cpp -std=c++20 -o $1
Expected result
Success compilation and usage of such string literals
Actual result/error
call.cpp2(32,0): error: end of file reached with 1 missing } to match earlier { on line 1
Additional context
I've encountered this inside lambda, when expanding it and changing short syntax to code block. Then discovered "/*" have same issue even without block.
"*/" doesn't seems to have problem.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working