The new smart match dispatch table for 5.10.1 onwards
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index f118d57..f512832 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4087,8 +4087,12 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
     if (SvGMAGICAL(e))
        e = sv_mortalcopy(e);
 
-    if (SM_OBJECT)
-       Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+    if (SM_OBJECT) {
+       if (!SvOK(d) || !SvOK(e))
+           RETPUSHNO;
+       else
+           Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+    }
 
     if (SM_CV_NEP) {
        I32 c;