From 0c6330ce7ee50c1fa241793588fa83a3c00bc3c1 Mon Sep 17 00:00:00 2001 From: lemon Date: Sat, 6 Aug 2022 16:11:26 +0200 Subject: inferred length array init --- bootstrap/cgen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bootstrap/cgen.c') diff --git a/bootstrap/cgen.c b/bootstrap/cgen.c index 9fa954c..8a01e09 100644 --- a/bootstrap/cgen.c +++ b/bootstrap/cgen.c @@ -554,10 +554,11 @@ defctype(const struct type *ty, void *_) { defctype(ty->child, NULL); break; case TYarr: - assert(ty->length >= 0); - defctype(ty->child, NULL); - *cname = xasprintf("__ty%d", id++); - pri("typedef %t %s[%U];\n", ty->child, *cname, ty->length); + if (ty->length >= 0) { + defctype(ty->child, NULL); + *cname = xasprintf("__ty%d", id++); + pri("typedef %t %s[%U];\n", ty->child, *cname, ty->length); + } break; case TYslice: defctype(ty->child, NULL); -- cgit v1.2.3