summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-01-02 15:04:50 +0000
committerDavid Mitchell <davem@iabyn.com>2011-01-02 20:00:27 +0000
commitbff33ce02f3be5fbb5af2c3c92e9853aaa12151e (patch)
tree1746f4f97dc78dea718bd943734b6bb019695c68
parentd1bea3d84afd8d32a236c8d800e5dfc0f837570e (diff)
downloadperl-bff33ce02f3be5fbb5af2c3c92e9853aaa12151e.tar.gz
overloaded <> sometimes left an extra stack arg
-rw-r--r--lib/overload.t19
-rw-r--r--pp.h2
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t
index f9ba064cff..20d3e21b95 100644
--- a/lib/overload.t
+++ b/lib/overload.t
@@ -48,7 +48,7 @@ package main;
$| = 1;
BEGIN { require './test.pl' }
-plan tests => 4936;
+plan tests => 4942;
use Scalar::Util qw(tainted);
@@ -2151,6 +2151,23 @@ fresh_perl_is
}
}
+# since 5.6 overloaded <> was leaving an extra arg on the stack!
+
+{
+ package Iter1;
+ use overload '<>' => sub { 11 };
+ package main;
+ my $a = bless [], 'Iter1';
+ my $x;
+ my @a = (10, ($x = <$a>), 12);
+ is ($a[0], 10, 'Iter1: a[0]');
+ is ($a[1], 11, 'Iter1: a[1]');
+ is ($a[2], 12, 'Iter1: a[2]');
+ @a = (10, ($x .= <$a>), 12);
+ is ($a[0], 10, 'Iter1: a[0] concat');
+ is ($a[1], 1111, 'Iter1: a[1] concat');
+ is ($a[2], 12, 'Iter1: a[2] concat');
+}
# EOF
diff --git a/pp.h b/pp.h
index debdd2d3e9..5ba9ae2109 100644
--- a/pp.h
+++ b/pp.h
@@ -446,6 +446,8 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
SPAGAIN; \
sp += shift; \
sv_setsv(TARG, tmpsv); \
+ if (opASSIGN) \
+ sp--; \
SETTARG; \
RETURN; \
} \