From 66b73f1fcee829bafa08e59a5507e3f1eb6144de Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sun, 10 Mar 2024 17:44:47 +0100 Subject: [PATCH] :art: disallow variadic unions --- src/sema/sema.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; } -- 2.43.0