# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #56638]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56638 >


The `return` built-in doesn't take zero arguments, like it can in Perl
5. The attached patch fixes this.

$ cat return_undef.pl
sub f { return undef }
say f()
$ ./perl6 return_undef.pl

$ cat return.pl
sub f { return }
say f()
$ ./perl6 return.pl
too few arguments passed (0) - 1 params expected
current instr.: 'f' pc 79 (EVAL_13:35)
called from Sub '_block11' pc 17 (EVAL_13:10)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
(src/PCT/HLLCompiler.pir:481)
called from Sub 'parrot;PCT::HLLCompiler;evalfiles' pc 1088
(src/PCT/HLLCompiler.pir:610)
called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1267
(src/PCT/HLLCompiler.pir:699)
called from Sub 'parrot;Perl6::Compiler;main' pc 13257 (perl6.pir:172)
perl6(73334) malloc: *** error for object 0x28909b0: double free
*** set a breakpoint in malloc_error_break to debug
Segmentation fault

$ patch -p0 < zero-arg-return.patch ; make perl6
[...]

$ ./perl6 return.pl

$

Attachment: zero-arg-return.patch
Description: Binary data

Reply via email to