mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* Require parenthesized assignment expressions in condition of 'if' statements #2716 * Move analysis to semantic checker and also check while. And update tests and release notes. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
12 lines
327 B
Plaintext
12 lines
327 B
Plaintext
fn void main()
|
|
{
|
|
int x = 5;
|
|
|
|
if (x = 1) {} // #error: An assignment in a conditional must have an extra parenthesis
|
|
|
|
if ((x = 1)) {}
|
|
|
|
while (x = 1) {} // #error: An assignment in a conditional must have an extra parenthesis
|
|
|
|
while (x = 1, x = 1) {} // #error: An assignment in the last conditional must be parenthesized
|
|
} |