=item *
+=for comment
+Not necessary for perl5160delta
+
The remaining discrepancies between explicit and implicit return from
lvalue subroutines have been resolved. They mainly involved which error
message to display when a read-only value is returned in lvalue context.
for implicit return. This is not a regression from 5.14, as all the cases
in which it could happen where previously syntax errors.
+=item *
+
+=for comment
+Not necessary for perl5160delta
+
+Explicitly returning a tied C<my> variable from an lvalue subroutine in
+list lvalue context used to clear the variable before the assignment could
+happen. This is something that was missed when explicit return was made to
+work in 5.15.0.
+
=back
=head1 Known Problems
@INC = '../lib';
require './test.pl';
}
-plan tests=>167;
+plan tests=>175;
sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
sub b : lvalue { ${\shift} }
is ($Tie_Array::val[0], "value");
+# Check that tied pad vars that are returned can be assigned to
+sub TIESCALAR { bless [] }
+sub STORE {$wheel = $_[1]}
+sub FETCH {$wheel}
+sub tied_pad_var :lvalue { tie my $tyre, ''; $tyre }
+sub tied_pad_varr :lvalue { tie my $tyre, ''; return $tyre }
+tied_pad_var = 1;
+is $wheel, 1, 'tied pad var returned in scalar lvalue context';
+tied_pad_var->${\sub{ $_[0] = 2 }};
+is $wheel, 2, 'tied pad var returned in scalar ref context';
+(tied_pad_var) = 3;
+is $wheel, 3, 'tied pad var returned in list lvalue context';
+$_ = 4 for tied_pad_var;
+is $wheel, 4, 'tied pad var returned in list ref context';
+tied_pad_varr = 5;
+is $wheel, 5, 'tied pad var explicitly returned in scalar lvalue context';
+tied_pad_varr->${\sub{ $_[0] = 6 }};
+is $wheel, 6, 'tied pad var explicitly returned in scalar ref context';
+(tied_pad_varr) = 7;
+is $wheel, 7, 'tied pad var explicitly returned in list lvalue context';
+$_ = 8 for tied_pad_varr;
+is $wheel, 8, 'tied pad var explicitly returned in list ref context';
+
+
# Test explicit return of lvalue expression
{
# subs are copies from tests 1-~18 with an explicit return added.