From cefe83c1e7018933a8784ffeec7f54c3ed4c14f1 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Sat, 24 Aug 2019 12:29:34 +0200 Subject: [PATCH] :bug: Ensure one can't 'new' ref types --- src/lib/opfunc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/opfunc.c b/src/lib/opfunc.c index ace7ddef..1530b3b7 100644 --- a/src/lib/opfunc.c +++ b/src/lib/opfunc.c @@ -98,6 +98,8 @@ OP_CHECK(opck_new) { const Exp_Unary* unary = (Exp_Unary*)data; SET_FLAG(unary->td, ref); DECL_OO(const Type, t, = known_type(env, unary->td)) + if(type_ref(t)) + ERR_N(td_pos(unary->td), _("can't use 'new' on ref type '%s'\n"), t->name) UNSET_FLAG(unary->td, ref); if(unary->td->array) CHECK_BO(check_exp_array_subscripts(env, unary->td->array->exp)) -- 2.43.0