Fix issue 5474

The fix was adding `is_constant = false;`

I also removed the unnecessary check regarding the first element of the
BitSet, since it's checked inside the loop, and also fixed a typo in the
message.
This commit is contained in:
Paul-Andre Henegar
2025-07-28 01:42:19 -04:00
parent a93d3503b1
commit 93a39affd1
+2 -6
View File
@@ -10335,13 +10335,10 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
is_constant = false; is_constant = false;
} }
if (cl->elems[0]->kind == Ast_FieldValue) {
error(cl->elems[0], "'field = value' in a bit_set a literal is not allowed");
is_constant = false;
} else {
for (Ast *elem : cl->elems) { for (Ast *elem : cl->elems) {
if (elem->kind == Ast_FieldValue) { if (elem->kind == Ast_FieldValue) {
error(elem, "'field = value' in a bit_set a literal is not allowed"); error(elem, "'field = value' in a bit_set literal is not allowed");
is_constant = false;
continue; continue;
} }
@@ -10382,7 +10379,6 @@ gb_internal ExprKind check_compound_literal(CheckerContext *c, Operand *o, Ast *
} }
} }
} }
}
break; break;
} }
case Type_BitField: { case Type_BitField: {