summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-08 22:37:03 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-05-08 22:37:03 +0200
commit6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a (patch)
tree0789c3863bdd0915e2532954c23eb5a7c886204b /pp_ctl.c
parent031a44ed339cfee9d4b2bc19abf15fa19412c9fd (diff)
downloadperl-6d743019f3ff1c2efcf74a1e4f98ea5bd3b7351a.tar.gz
Make ~~ overloading only be invoked on the right argument
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 5e8d5570a0..c601f7cbb8 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4006,7 +4006,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
# define SM_SEEN_OTHER(sv) hv_exists_ent(seen_other, \
sv_2mortal(newSViv(PTR2IV(sv))), 0)
- if (SvAMAGIC(d) || SvAMAGIC(e)) {
+ if (SvAMAGIC(e)) {
SV * const tmpsv = amagic_call(d, e, smart_amg, 0);
if (tmpsv) {
SPAGAIN;
@@ -4039,8 +4039,7 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
RETPUSHYES;
}
- if ((sv_isobject(d) && (SvTYPE(SvRV(d)) != SVt_REGEXP))
- || (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP)))
+ if (sv_isobject(e) && (SvTYPE(SvRV(e)) != SVt_REGEXP))
Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
/* ~~ sub */