issue42.t 723 B

12345678910111213141516171819202122232425
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=42
  3. # B::CC uses value from void context in next list context
  4. use Test::More tests => 1;
  5. use strict;
  6. BEGIN {
  7. unshift @INC, 't';
  8. require "test.pl";
  9. }
  10. # Explanation:
  11. # - f1 is called, it puts value 1 on the stack.
  12. # - f2 should discard this value, because f1 is called in void context.
  13. # - But if a block follows, this value is accidently added to the list
  14. # of return values of f2.
  15. my $script = <<'EOF';
  16. sub f1 { 1 }
  17. f1();
  18. print do { 7; 2 }, "\n";
  19. EOF
  20. # fixed with r596. remove enter/leave from %no_stack, sp sync.
  21. ctest(1, '^2$', "CC", "ccode42i", $script,
  22. 'CC uses value from void context in next list context, fixed with r596');