You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How about that... somehow I had in my head that the ; was always required. I'm a little surprised that the second example works... perhaps it's looking for any valid expression (which would maximally grab as much as could be a valid expression, which could include an expression_statement) rather than specifically an expression-statement.
Well, for the terse syntax I just changed the check to see if there was a valid expression instead of expression-statement and all seems to be well. Let's try it. Saves another character on the tersest syntax...
Also, just to make sure it still works on a non-first argument, this is fine too now with the latest commit above:
main: () = {
a: std::vector<int> = (1, 2, 3);
b: std::vector<int> = (7, 8, 9);
test( :(x) x+1, a, b );
for b do (e) std::cout << e;
}
test: (c, a, inout b) =
std::transform(a.begin(), a.end(), b.begin(), c);
Thanks!
zaucy
pushed a commit
to zaucy/cppfront
that referenced
this issue
Dec 5, 2023
Describe the bug
A trailing semicolon is required when dropping the
-> _ =
from an inline lambda expression used inside a function call.To Reproduce
Steps to reproduce the behavior:
Command lines including which C++ compiler you are using
https://www.godbolt.org/z/6T9z4nx88
Expected result - what you expected to happen
Successful compilation.
Actual result/error
error: invalid statement encountered inside a compound-statement (at 'x')
Additional context
#714
The text was updated successfully, but these errors were encountered: