aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index df190d85ac..0e9a17b7a6 100644
--- a/complex.c
+++ b/complex.c
@@ -747,6 +747,8 @@ nucomp_coerce(VALUE self, VALUE other)
{
if (k_numeric_p(other) && f_real_p(other))
return rb_assoc_new(f_complex_new_bang1(CLASS_OF(self), other), self);
+ if (TYPE(other) == T_COMPLEX)
+ return rb_assoc_new(other, self);
rb_raise(rb_eTypeError, "%s can't be coerced into %s",
rb_obj_classname(other), rb_obj_classname(self));