Files
c3c/test/test_suite/statements/if_assign.c3
VarunVF 64ef33f09b Require parenthesized assignment expressions in condition of 'if' statements #2716 (#2729)
* 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>
2026-01-15 00:43:58 +01:00

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
}