Catch accidental foo == BAR; where foo = BAR; was most likely intended. #2274

This commit is contained in:
Christoffer Lerno
2025-07-05 20:40:55 +02:00
parent 0d170a70b6
commit 7cdb1ce9eb
3 changed files with 28 additions and 1 deletions

View 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;
}