mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Catch accidental foo == BAR; where foo = BAR; was most likely intended. #2274
This commit is contained in:
19
test/test_suite/expressions/discarded_binary.c3
Normal file
19
test/test_suite/expressions/discarded_binary.c3
Normal file
@@ -0,0 +1,19 @@
|
||||
enum Foo
|
||||
{
|
||||
COMMENT
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Foo state = COMMENT;
|
||||
char c;
|
||||
switch (c)
|
||||
{
|
||||
case '#':
|
||||
(void)(state == COMMENT);
|
||||
state == COMMENT; // #error: This equals check was discarded
|
||||
int a = 0;
|
||||
a == 0; // #error: This equals check was discarded
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user