From a9f10a4caabed511fe18295b8c89a4c54554dcc6 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Thu, 8 Dec 2022 14:31:47 +0100 Subject: [PATCH] :art: Ensure array extensions use literals --- src/parse/scan0.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 751d0739..6c71530e 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -296,6 +296,12 @@ ANN static inline Type scan0_final(const Env env, Type_Decl *td) { ANN static Type cdef_parent(const Env env, const Class_Def cdef) { if (cflag(cdef, cflag_struct)) return env->gwion->type[et_compound]; if (!cdef->base.ext) return env->gwion->type[et_object]; + Exp e = cdef->base.ext->array ? cdef->base.ext->array->exp : NULL; + while(e) { + if(!is_prim_int(e)) + ERR_O(e->pos, "non null array type extension must be literal"); + e = e->next; + } if (tmpl_base(cdef->base.tmpl)) return get_parent_base(env, cdef->base.ext); const bool tmpl = !!cdef->base.tmpl; if (tmpl) template_push_types(env, cdef->base.tmpl); -- 2.43.0