diff --git a/src/aro/Parser.zig b/src/aro/Parser.zig index 39f15b8a..7276d177 100644 --- a/src/aro/Parser.zig +++ b/src/aro/Parser.zig @@ -6934,7 +6934,7 @@ fn unExpr(p: *Parser) Error!Result { try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); try operand.usualUnaryConversion(p, tok); - if (operand.val.is(.int, p.comp)) { + if (operand.val.is(.int, p.comp) or operand.val.is(.float, p.comp)) { _ = try operand.val.sub(Value.zero, operand.val, operand.ty, p.comp); } else { operand.val = .{}; diff --git a/test/cases/float values.c b/test/cases/float values.c new file mode 100644 index 00000000..3d16702c --- /dev/null +++ b/test/cases/float values.c @@ -0,0 +1,2 @@ +_Static_assert(-1.0 - 1.0 == -2.0, ""); +_Static_assert(-2.0f == -2.0, "");