diff options
-rw-r--r-- | lib/overload.t | 19 | ||||
-rw-r--r-- | pp.h | 2 |
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 @@ -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; \ } \ |