summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-06-12 09:53:03 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-06-12 09:53:03 -0700
commitdbc93621c94b9b2d2b437cde40d8efec7337a64d (patch)
tree8550bf598238104c6490d15ad2db20d4c103ea75 /src
parent16424a14dc3b1a70ef8ebe3923c3dbd482e77c93 (diff)
parentc9caea64c81a2679ea7c832173aa3e30aa931f3e (diff)
downloadmruby-dbc93621c94b9b2d2b437cde40d8efec7337a64d.tar.gz
mruby-dbc93621c94b9b2d2b437cde40d8efec7337a64d.zip
Merge pull request #1281 from Bovi-Li/singleton
Singleton raises TypeError on #new
Diffstat (limited to 'src')
-rw-r--r--src/class.c3
1 files changed, 3 insertions, 0 deletions
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);