commit 2ff3f3a3928f52bc20b2f851975b40c43b78ec7b
parent d4282c9f9b3e1fe348fbd66c09fd2f0accd1b327
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 25 Dec 2020 11:05:46 -0500
check: prohibit len on undefined length arrays
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/check.c b/src/check.c
@@ -337,7 +337,8 @@ check_expr_measure(struct context *ctx,
enum type_storage vstor = expr->measure.value->result->storage;
expect(vstor == TYPE_STORAGE_ARRAY || vstor == TYPE_STORAGE_SLICE,
"len argument must be of an array or slice type");
- // TODO: Check that array type is not unbounded
+ expect(expr->measure.value->result->size != SIZE_UNDEFINED,
+ "Cannot take length of array type with undefined length");
break;
case M_SIZE:
expr->measure.type = type_store_lookup_atype(