(even if $object hasn't overloaded the ~~ operator)
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;
! $ov_obj "foo"
! $ov_obj \&foo
@ $ov_obj \&fatal
+! $ov_obj undef
# regular object
@ $obj "key"
@ $obj sub { 0 }
@ $obj \&foo
@ $obj \&fatal
+! $obj undef
# CODE ref against argument
# - arg is code ref