summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'class.c')
-rw-r--r--class.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/class.c b/class.c
index 6674ae1a9df..fed2edf4ee4 100644
--- a/class.c
+++ b/class.c
@@ -180,6 +180,9 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
VALUE
rb_class_init_copy(VALUE clone, VALUE orig)
{
+ if (orig == rb_cBasicObject) {
+ rb_raise(rb_eTypeError, "can't copy the root class");
+ }
if (RCLASS_SUPER(clone) != 0 || clone == rb_cBasicObject) {
rb_raise(rb_eTypeError, "already initialized class");
}