aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-07-09 16:14:35 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-07-09 16:14:35 +0200
commit5483cfe95e156118c01c35492c2d3a29ff5a2b15 (patch)
tree74d739ebe15a0943545a806e3f5296e4d0665992
parent69ef9d69fbc33627c5de2a0dddf3d23213a753d4 (diff)
Allow negation of untyped integer constant
-rw-r--r--src/analyzer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/analyzer.c b/src/analyzer.c
index 6154029..4b15e0a 100644
--- a/src/analyzer.c
+++ b/src/analyzer.c
@@ -417,7 +417,7 @@ analyzeexpr(struct azctx *ctx, idx_t i)
SET_DST_IF_SRC(ctx->cnst, i, rhs);
type_t *t = ctx->types[rhs];
if (ctx->ast.kinds[i] == ASTUNNEG
- && (t->kind != TYPE_NUM || !t->issigned))
+ && (t->kind != TYPE_NUM || (!t->issigned && t->size != 0)))
{
err("analyzer: Unary negation is reserved for signed numeric "
"types");