# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #57396]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=57396 >
$ ./perl6 -e 'my $x; $x.foo()'
works, but
$ ./perl6 -e 'sub a { my $x; $x.foo() }; a()'
Method 'foo' not found for invocant of class 'Undef'
current instr.: 'a' pc 82 (EVAL_13:42)
called from Sub '_block11' pc 17 (EVAL_13:11)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
(src/PCT/HLLCompiler.pir:481)
called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305
(src/PCT/HLLCompiler.pir:708)
called from Sub 'parrot;Perl6::Compiler;main' pc 14623 (perl6.pir:172)
perl6(33740) malloc: *** error for object 0x2994f90: double free
*** set a breakpoint in malloc_error_break to debug
Segmentation fault
doesn't.
The method call "$x.foo()" can be replaced with other things that
attempt to read $x -- such as "$x++" or "$x[0]" -- with similar
results.
Actually, this segfaults too, even though execution never enters the sub:
$ ./perl6 -e 'sub a { my $x; $x.foo() }; A()'
invoke() not implemented in class 'Undef'
current instr.: '_block11' pc 23 (EVAL_13:15)
called from Sub 'parrot;PCT::HLLCompiler;eval' pc 806
(src/PCT/HLLCompiler.pir:481)
called from Sub 'parrot;PCT::HLLCompiler;command_line' pc 1305
(src/PCT/HLLCompiler.pir:708)
called from Sub 'parrot;Perl6::Compiler;main' pc 14902 (perl6.pir:172)
perl6(37079) malloc: *** error for object 0x298f720: double free
*** set a breakpoint in malloc_error_break to debug
Segmentation fault