-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Contract after simple expression function fails #356
Labels
bug
Something isn't working
Comments
This is all about this: Lines 3858 to 3873 in f83ca9b
|
I have a fix for that. No impact on regression tests. Last tests are running and will push it. |
filipsajdak
added a commit
to filipsajdak/cppfront
that referenced
this issue
Apr 11, 2023
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes hsutter#356
filipsajdak
added a commit
to filipsajdak/cppfront
that referenced
this issue
Apr 16, 2023
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes hsutter#356
hsutter
pushed a commit
that referenced
this issue
Apr 16, 2023
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes #356
zaucy
pushed a commit
to zaucy/cppfront
that referenced
this issue
Dec 5, 2023
Current implementation does not work for the following code: ```cpp main: () = { :() = 1; [[assert: 1]] } ``` It fails with error: ``` error: subscript expression [ ] must not be empty (if you were trying to name a C-style array type, use 'std::array' instead) (at '[') ``` This change introduce small correction that moves back parsing to semicolon (to simulate double semicolon) for short syntax. It is not done in the following cases: ```cpp :() = 1;(); // imediatelly called lambda f(a,b,:() = 1;); // last argument in function call f(a,:() = 1;,c); // first or in the middle argument ``` After this change the original issue is solved. All regression tests pass. Closes hsutter#356
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works with an extra
;
, if the expression function has a compound-statement, or with a statement in-between.Minimal reproducer (https://godbolt.org/z/TfajzxMT1):
Commands:
Expected result: The same as any of the first two workarounds above.
Actual result and error:
The text was updated successfully, but these errors were encountered: