This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #31946] Warn when assigning to a TEMP
authorFather Chrysostomos <sprout@cpan.org>
Mon, 30 May 2011 16:49:36 +0000 (09:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 30 May 2011 16:49:36 +0000 (09:49 -0700)
commit8fe85e3fe48130bc5b95139890db97fc7a6c2c49
tree394c2336ee5c558365078306c9ecba6a6b76df92
parentd34a666494db40538f88613ec991214f3a862865
[perl #31946] Warn when assigning to a TEMP

This is the first step in downgrading a fatal error (Can't return a
temporary from lvalue subroutine) to a warning. Currently only XS
lvalue routines that return TEMPs and pure-Perl lvalue routines that
use explicit return (which don’t quite work properly yet anyway,
despite commit fa1e92c) are affected by this.

This is implemented in pp_sassign and pp_aassign, rather than
pp_leavesublv, so it will affect explicit returns and so it will
be skipped for overloaded ‘.=’, etc.

Thanks to Craig DeForest for suggesting how to do this.
pod/perldiag.pod
pp_hot.c