]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Ensure one can't 'new' ref types
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 24 Aug 2019 10:29:34 +0000 (12:29 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sat, 24 Aug 2019 10:29:34 +0000 (12:29 +0200)
src/lib/opfunc.c

index ace7ddef2c7d4e4b3d73c5bbde92c22e19b30415..1530b3b7e7848e99315f1833889b57d000664440 100644 (file)
@@ -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))