develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134072] sub prototypes not tracking refalias \&foo = \&bar

From:
Tony Cook via RT
Date:
June 12, 2019 02:08
Subject:
[perl #134072] sub prototypes not tracking refalias \&foo = \&bar
Message ID:
rt-4.0.24-2559-1560305287-430.134072-15-0@perl.org
On Tue, 14 May 2019 23:09:38 -0700, tonyc wrote:
> On Tue, 30 Apr 2019 16:50:20 -0700, jim.avera@gmail.com wrote:
> > Not sure whether this is intended behavior, but just in case it's
> > not...
> > 
> > The refalias
> >   \&foo = \&bar
> > is documented as "foo() now means bar()", but it doesn't entirely:
> > 
> > In subsequently-compiled code, the compiler still wants calls
> > to foo() to match the old foo's prototype, not the prototype of bar.
> > 
> > 
> > #!/usr/bin/perl
> > use strict; use warnings; use v5.22.0;
> > 
> > use feature 'refaliasing';
> > no warnings 'experimental::refaliasing';
> > 
> > sub foo($$$$) { }
> > sub bar($) { }
> > 
> > BEGIN{ \&foo = \&bar; }
> > 
> > foo(1);  # Gets "Not enough arguments for main::foo"
> 
> Fix attached.

Applied as 40258daf9899686d934c460ba3630431312d7694.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134072



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About