aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-04-17 20:06:51 +0200
committerlemon <lsof@mailbox.org>2026-04-17 20:06:51 +0200
commit919cbebac4a66dfde36aa2accd84abdba2909080 (patch)
treed3b875fbd6c09d27a254a063580f187231782020 /src
parent5293b3cc8876cbc775875974e0c1b7e32952b140 (diff)
c: fix using array as condition value
Decays to pointer
Diffstat (limited to 'src')
-rw-r--r--src/c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/c.c b/src/c.c
index 21deb20..20c53ff 100644
--- a/src/c.c
+++ b/src/c.c
@@ -1267,7 +1267,7 @@ Unary:
Expr *sub;
span.sl = tk.span.sl;
span.ex = ex.span.ex;
- if (!isscalar(ex.ty) && !isptrcvt(ex.ty))
+ if (!isptrcvt(ex.ty) && !isscalar(ex.ty))
error(&ex.span, "?: condition is not a scalar type: '%ty'", ex.ty);
tmp = commaexpr(cm);
joinspan(&tk.span.ex, tmp.span.ex);
@@ -4462,7 +4462,7 @@ stmt(CComp *cm, Function *fn)
expect(cm, '(', NULL);
ex = commaexpr(cm);
expect(cm, ')', NULL);
- if (!isscalar(ex.ty))
+ if (!isptrcvt(ex.ty) && !isscalar(ex.ty))
error(&ex.span, "'if' condition is not a scalar '%ty'", ex.ty);
tr = fl = end = NULL;
EMITS {