From c9caea64c81a2679ea7c832173aa3e30aa931f3e Mon Sep 17 00:00:00 2001 From: Daniel Bovensiepen Date: Sun, 9 Jun 2013 11:21:51 +0800 Subject: Singleton raises TypeError on #new --- src/class.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/class.c b/src/class.c index f446c56bc..f94f9a933 100644 --- a/src/class.c +++ b/src/class.c @@ -1047,6 +1047,9 @@ mrb_instance_new(mrb_state *mrb, mrb_value cv) mrb_value *argv; int argc; + if (c->tt == MRB_TT_SCLASS) + mrb_raise(mrb, E_TYPE_ERROR, "can't create instance of singleton class"); + if (ttype == 0) ttype = MRB_TT_OBJECT; o = (struct RObject*)mrb_obj_alloc(mrb, ttype, c); obj = mrb_obj_value(o); -- cgit v1.2.3