commit 54790823df08e5a59dc080e59b70ecbbd433060c
parent 444f9ae789ffc750f98b7ce512e5c3e7c1762f08
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 29 Aug 2022 14:49:11 +0200
check: fix test for alloc slice capacity
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -373,6 +373,7 @@ check_expr_alloc_slice(struct context *ctx,
struct expression cap = {0};
if (expr->alloc.init->type == EXPR_CONSTANT
+ && expr->alloc.cap->type == EXPR_CONSTANT
&& eval_expr(ctx, expr->alloc.cap, &cap) == EVAL_OK) {
uintmax_t len = 0;
for (struct array_constant *c = expr->alloc.init->constant.array;