Closed
Description
Title: Statement parameter list can't follow a function expression.
Minimal reproducer (https://cpp2.godbolt.org/z/Ga4rTro9G):
f: () = {
_ := :() 0;
(_ := 0) _ = 0;
}
main: () = { }
Commands:
cppfront main.cpp2
clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -Werror=unused-value -Werror=unused-parameter -I . main.cpp
Expected result: For each line in f
to parse as a separate statement.
Actual result and error:
main.cpp2...
main.cpp2(3,6): error: unexpected text - ( is not properly matched by ) (at ':')
main.cpp2(3,6): error: ill-formed initializer (at ':')
main.cpp2(1,9): error: ill-formed initializer (at '{')
main.cpp2(1,1): error: unexpected text at end of Cpp2 code section (at 'f')
main.cpp2(1,0): error: parse failed for section starting here