From: fennecdjay Date: Sun, 10 Mar 2024 16:44:47 +0000 (+0100) Subject: :art: disallow variadic unions X-Git-Tag: nightly~37 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=66b73f1fcee829bafa08e59a5507e3f1eb6144de;p=gwion.git :art: disallow variadic unions --- diff --git a/src/sema/sema.c b/src/sema/sema.c index 1967ea05..811e8844 100644 --- a/src/sema/sema.c +++ b/src/sema/sema.c @@ -735,8 +735,15 @@ ANN static bool sema_union_def(Sema *a, Union_Def b) { if(!type_decl_array_empty(a, c->td, "in union member")) ok = false; } - if(b->tmpl && !sema_tmpl(a, b->tmpl)) - ok = false; + if(b->tmpl) { + if(!sema_tmpl(a, b->tmpl)) + ok = false; + if(is_spread_tmpl(b->tmpl)) { + gwerr_basic(_("unions can't be variadic"), NULL, NULL, + a->filename, b->tag.loc, 0); + ok = false; + } + } return ok; }