diff options
| author | 2022-08-06 16:11:26 +0200 | |
|---|---|---|
| committer | 2022-08-06 16:11:26 +0200 | |
| commit | 0c6330ce7ee50c1fa241793588fa83a3c00bc3c1 (patch) | |
| tree | 3c8c42804a8056a61b267d690a13688d6580630a /bootstrap/cgen.c | |
| parent | c53e17496d97a2fb638544cee414de97d81770fc (diff) | |
inferred length array init
Diffstat (limited to 'bootstrap/cgen.c')
| -rw-r--r-- | bootstrap/cgen.c | 9 |
1 files changed, 5 insertions, 4 deletions
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); |