-
Notifications
You must be signed in to change notification settings - Fork 577
Parsing lvalue subs returning a reference to a scalar #16575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @philiprbrenanReply-To: philiprbrenan@gmail.com This is a bug report for perl generated with the help of perlbug 1.40 #!/usr/bin/perl =pod Lvalue subs returning a reference to a scalar are not always recognized in =cut my $aaa; # Scalar - all OK sub aaa:lvalue {\my $r} # Scalar returned via Lvalue sub Flags: Site configuration information for perl 5.22.1: Configured by Debian Project at Thu Apr 5 12:48:47 UTC 2018. Summary of my perl5 (revision 5 version 22 subversion 1) configuration: Platform: Locally applied patches: @INC for perl 5.22.1: Environment for perl 5.22.1: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/phil/Android/sdk/tools/:/home/phil/Android/sdk/platform-tools/:/home/phil/.local/bin:/home/phil/Android/sdk/tools/:/home/phil/Android/sdk/platform-tools/:/home/phil/.local/bin |
From @cpansproutOn Fri, 01 Jun 2018 17:47:28 -0700, philiprbrenan@gmail.com wrote:
I think you want to drop the backslash.
Although, conceivably these should do aliasing, just like \$r = \.... -- Father Chrysostomos |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Fri, 01 Jun 2018 17:47:28 -0700, philiprbrenan@gmail.com wrote:
I’ve just looked at it more closely. You are getting those syntax errors because aaa() has list precedence. If you declare it like this: sub aaa():lvalue {\my $r} there is no output, so it compiles without incident. But that it runs without incident I think is a bug. It looks like a side effect of refaliasing. This: use experimental 'refaliasing'; gives me: SCALAR(0x7fc64a82b768) at - line 4. which shows that the assignment did nothing. It should probably have produced this: SCALAR(0x7fc64a82b858) at - line 4. -- Father Chrysostomos |
Migrated from rt.perl.org#133240 (status was 'open')
Searchable as RT133240$
The text was updated successfully, but these errors were encountered: