From: fennecdjay Date: Thu, 15 Dec 2022 13:41:17 +0000 (+0100) Subject: :art: no refs in union X-Git-Tag: nightly~207^2~39 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=b76a473c0e958e1abf4329a3ac923dd8d83fd752;p=gwion.git :art: no refs in union --- diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 449f5a65..eda5c7ea 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -476,6 +476,8 @@ ANN static inline m_bool scan1_union_def_inner_loop(const Env env, DECL_OB(const Type, t, = known_type(env, um->td)); if (nspc_lookup_value0(env->curr, um->vd.xid)) ERR_B(um->vd.pos, _("'%s' already declared in union"), s_name(um->vd.xid)) + if(tflag(t, tflag_ref)) + ERR_B(um->vd.pos, _("can't declare ref type in union")); const Value v = new_value(env, t, s_name(um->vd.xid), um->vd.pos); tuple_contains(env, v); valuefrom(env, v->from); diff --git a/tests/union/union_ref.gw b/tests/union/union_ref.gw new file mode 100644 index 00000000..c560ebdc --- /dev/null +++ b/tests/union/union_ref.gw @@ -0,0 +1,3 @@ +union U { + &int i; +}