8 sub a : lvalue { my $a = 34; ${\(bless \$a)} } # Return a temporary
9 sub b : lvalue { ${\shift} }
11 my $out = a(b()); # Check that temporaries are allowed.
12 is(ref $out, 'main'); # Not reached if error.
14 my @out = grep /main/, a(b()); # Check that temporaries are allowed.
15 cmp_ok(scalar @out, '==', 1); # Not reached if error.
19 # Check that we can return localized values from subroutines:
21 sub in : lvalue { $in = shift; }
22 sub neg : lvalue { #(num_str) return num_str
32 sub get_lex : lvalue { $in }
33 sub get_st : lvalue { $blah }
34 sub id : lvalue { ${\shift} }
35 sub id1 : lvalue { $_[0] }
36 sub inc : lvalue { ${\++$_[0]} }
43 cmp_ok($blah, '==', 7);
51 cmp_ok($blah, '==', 8);
59 cmp_ok($blah, '==', 10);
63 cmp_ok($in, '==', 10);
67 cmp_ok($blah, '==', 11);
71 cmp_ok($in, '==', 11);
75 cmp_ok($blah, '==', 20);
79 cmp_ok($in, '==', 20);
83 cmp_ok($blah, '==', 21);
87 cmp_ok($in, '==', 21);
91 cmp_ok($blah, '==', 22);
95 cmp_ok($in, '==', 22);
99 cmp_ok($blah, '==', 23);
103 cmp_ok($in, '==', 23);
105 ++inc(id1(id(get_st)));
107 cmp_ok($blah, '==', 25);
109 ++inc(id1(id(get_lex)));
111 cmp_ok($in, '==', 25);
115 $#c = 3; # These slots are not fillable.
117 # Explanation: empty slots contain &sv_undef.
119 =for disabled constructs
127 eval <<'EOE' or $_ = $@;
128 ($x, a3, $y, b2, $z, c4, $t) = (34 .. 78);
132 #@out = ($x, a3, $y, b2, $z, c4, $t);
133 #@in = (34 .. 41, (undef) x 4, 46);
134 #print "# '@out' ne '@in'\nnot " unless "@out" eq "@in";
136 like($_, qr/Can\'t return an uninitialized value from lvalue subroutine/);
144 sub a::var : lvalue { $var }
148 cmp_ok($var, '==', 45);
151 $o = bless \$oo, "a";
155 cmp_ok($var, '==', 47);
157 sub o : lvalue { $o }
161 cmp_ok($var, '==', 49);
163 sub nolv () { $x0, $x1 } # Not lvalue
167 eval <<'EOE' or $_ = $@;
172 like($_, qr/Can\'t modify non-lvalue subroutine call in scalar assignment/);
176 eval <<'EOE' or $_ = $@;
181 like($_, qr/Can\'t modify non-lvalue subroutine call in scalar assignment/);
185 eval <<'EOE' or $_ = $@;
190 like($_, qr/Can\'t modify non-lvalue subroutine call in scalar assignment/);
192 $x0 = $x1 = $_ = undef;
195 eval <<'EOE' or $_ = $@;
196 $nolv->() = (2,3) if $_;
200 ok(!defined $_) or diag "'$_', '$x0', '$x1'";
202 $x0 = $x1 = $_ = undef;
205 eval <<'EOE' or $_ = $@;
210 like($_, qr/Can\'t modify non-lvalue subroutine call/)
211 or diag "'$_', '$x0', '$x1'";
214 sub rlv0 : lvalue { return }
217 eval <<'EOE' or $_ = $@;
222 like($_, qr/Can't return undef from lvalue subroutine/);
225 eval <<'EOE' or $_ = $@;
230 like($_, qr/Can't return undef from lvalue subroutine/,
231 'explicit return of nothing in scalar context');
234 eval <<'EOE' or $_ = $@;
239 ok(!defined $_) or diag $_;
242 eval <<'EOE' or $_ = $@;
247 ok(!defined $_, 'explicit return of nothing in list context') or diag $_;
250 (lv0($a,$b)) = (3,4);
251 is +($a//'undef') . ($b//'undef'), 'undefundef',
252 'list assignment to empty lvalue sub';
255 sub lv1u :lvalue { undef }
256 sub rlv1u :lvalue { undef }
259 eval <<'EOE' or $_ = $@;
264 like($_, qr/Can't return undef from lvalue subroutine/);
267 eval <<'EOE' or $_ = $@;
272 like($_, qr/Can't return undef from lvalue subroutine/,
273 'explicitly returning undef in scalar context');
276 eval <<'EOE' or $_ = $@;
281 ok(!defined, 'implicitly returning undef in list context');
284 eval <<'EOE' or $_ = $@;
289 ok(!defined, 'explicitly returning undef in list context');
294 eval <<'EOE' or $_ = $@;
295 sub lv1t : lvalue { index $x, 2 }
300 like($_, qr/Can\'t return a temporary from lvalue subroutine/);
303 eval <<'EOE' or $_ = $@;
304 sub rlv1t : lvalue { index $x, 2 }
309 like($_, qr/Can\'t return a temporary from lvalue subroutine/,
310 'returning a PADTMP explicitly');
313 eval <<'EOE' or $_ = $@;
318 like($_, qr/Can\'t return a temporary from lvalue subroutine/,
319 'returning a PADTMP explicitly (list context)');
322 sub lv2t : lvalue { shift }
327 sub xxx () { $xxx } # Not lvalue
330 eval <<'EOE' or $_ = $@;
331 sub lv1tmp : lvalue { xxx } # is it a TEMP?
336 like($_, qr/Can\'t modify non-lvalue subroutine call at /);
339 eval <<'EOE' or $_ = $@;
344 like($_, qr/Can\'t modify non-lvalue subroutine call at /);
346 sub yyy () { 'yyy' } # Const, not lvalue
349 eval <<'EOE' or $_ = $@;
350 sub lv1tmpr : lvalue { yyy } # is it read-only?
355 like($_, qr/Can\'t return a readonly value from lvalue subroutine at/);
358 eval <<'EOE' or $_ = $@;
363 like($_, qr/Can\'t return a readonly value from lvalue subroutine/);
365 sub lva : lvalue {@a}
370 eval <<'EOE' or $_ = $@;
375 is("'@a' $_", "'2 3' ");
381 eval <<'EOE' or $_ = $@;
386 is("'@a' $_", "'2 3' ");
388 is lva->${\sub { return $_[0] }}, 2,
389 'lvalue->$thing when lvalue returns array';
391 my @my = qw/ a b c /;
392 sub lvmya : lvalue { @my }
394 is lvmya->${\sub { return $_[0] }}, 3,
395 'lvalue->$thing when lvalue returns lexical array';
397 sub lv1n : lvalue { $newvar }
400 eval <<'EOE' or $_ = $@;
405 is("'$newvar' $_", "'4' ");
407 sub lv1nn : lvalue { $nnewvar }
410 eval <<'EOE' or $_ = $@;
415 is("'$nnewvar' $_", "'3' ");
421 eval 'sub AUTOLOAD : lvalue { $newvar }';
425 # But autoloading should only be triggered by a call to an undefined
428 is $newvar, 12, 'AUTOLOAD does not take precedence over lvalue sub';
429 eval { &{"xxx"} = 14 };
430 is $newvar, 12, 'AUTOLOAD does not take precedence over non-lvalue sub';
434 sub alv : lvalue { $array[1] }
435 sub alv2 : lvalue { $array[$_[0]] }
436 sub hlv : lvalue { $hash{"foo"} }
437 sub hlv2 : lvalue { $hash{$_[0]} }
438 $array[1] = "not ok 51\n";
440 is(alv(), "ok 50\n");
442 alv2(20) = "ok 51\n";
443 is($array[20], "ok 51\n");
445 $hash{"foo"} = "not ok 52\n";
447 is($hash{foo}, "ok 52\n");
449 $hash{bar} = "not ok 53\n";
450 hlv("bar") = "ok 53\n";
451 is(hlv("bar"), "ok 53\n");
453 sub array : lvalue { @array }
454 sub array2 : lvalue { @array2 } # This is a global.
455 sub hash : lvalue { %hash }
456 sub hash2 : lvalue { %hash2 } # So's this.
457 @array2 = qw(foo bar);
458 %hash2 = qw(foo bar);
460 (array()) = qw(ok 54);
461 is("@array", "ok 54");
463 (array2()) = qw(ok 55);
464 is("@array2", "ok 55");
466 (hash()) = qw(ok 56);
467 cmp_ok($hash{ok}, '==', 56);
469 (hash2()) = qw(ok 57);
470 cmp_ok($hash2{ok}, '==', 57);
472 @array = qw(a b c d);
473 sub aslice1 : lvalue { @array[0,2] };
474 (aslice1()) = ("ok", "already");
475 is("@array", "ok b already d");
477 @array2 = qw(a B c d);
478 sub aslice2 : lvalue { @array2[0,2] };
479 (aslice2()) = ("ok", "already");
480 is("@array2", "ok B already d");
482 %hash = qw(a Alpha b Beta c Gamma);
483 sub hslice : lvalue { @hash{"c", "b"} }
484 (hslice()) = ("CISC", "BogoMIPS");
485 is(join("/",@hash{"c","a","b"}), "CISC/Alpha/BogoMIPS");
488 $str = "Hello, world!";
489 sub sstr : lvalue { substr($str, 1, 4) }
491 is($str, "Hi, world!");
493 $str = "Made w/ JavaScript";
494 sub veclv : lvalue { vec($str, 2, 32) }
495 if (ord('A') != 193) {
496 veclv() = 0x5065726C;
499 veclv() = 0xD7859993;
501 is($str, "Made w/ PerlScript");
503 sub position : lvalue { pos }
505 $_ = "fee fi fo fum";
512 sub keeze : lvalue { keys %__ }
515 is scalar %__, '1/64', 'keys assignment through lvalue sub';
517 # Bug 20001223.002: split thought that the list had only one element
519 sub lval1 : lvalue { $ary[0]; }
520 sub lval2 : lvalue { $ary[1]; }
521 (lval1(), lval2()) = split ' ', "1 2 3 4";
523 is(join(':', @ary), "1:2:6");
525 # check that an element of a tied hash/array can be assigned to via lvalueness
530 sub TIEHASH { bless \my $v => __PACKAGE__ }
531 sub STORE { ($key, $val) = @_[1,2] }
534 sub lval_tie_hash : lvalue {
535 tie my %t => 'Tie_Hash';
539 eval { lval_tie_hash() = "value"; };
541 is($@, "", "element of tied hash");
543 is("$Tie_Hash::key-$Tie_Hash::val", "key-value");
549 sub TIEARRAY { bless \my $v => __PACKAGE__ }
550 sub STORE { $val[ $_[1] ] = $_[2] }
553 sub lval_tie_array : lvalue {
554 tie my @t => 'Tie_Array';
558 eval { lval_tie_array() = "value"; };
561 is($@, "", "element of tied array");
563 is ($Tie_Array::val[0], "value");
566 # Check that tied pad vars that are returned can be assigned to
567 sub TIESCALAR { bless [] }
568 sub STORE {$wheel = $_[1]}
570 sub tied_pad_var :lvalue { tie my $tyre, ''; $tyre }
571 sub tied_pad_varr :lvalue { tie my $tyre, ''; return $tyre }
573 is $wheel, 1, 'tied pad var returned in scalar lvalue context';
574 tied_pad_var->${\sub{ $_[0] = 2 }};
575 is $wheel, 2, 'tied pad var returned in scalar ref context';
577 is $wheel, 3, 'tied pad var returned in list lvalue context';
578 $_ = 4 for tied_pad_var;
579 is $wheel, 4, 'tied pad var returned in list ref context';
581 is $wheel, 5, 'tied pad var explicitly returned in scalar lvalue context';
582 tied_pad_varr->${\sub{ $_[0] = 6 }};
583 is $wheel, 6, 'tied pad var explicitly returned in scalar ref context';
585 is $wheel, 7, 'tied pad var explicitly returned in list lvalue context';
586 $_ = 8 for tied_pad_varr;
587 is $wheel, 8, 'tied pad var explicitly returned in list ref context';
590 # Test explicit return of lvalue expression
592 # subs are copies from tests 1-~18 with an explicit return added.
593 # They used not to work, which is why they are ‘badly’ named.
594 sub bad_get_lex : lvalue { return $in };
595 sub bad_get_st : lvalue { return $blah }
597 sub bad_id : lvalue { return ${\shift} }
598 sub bad_id1 : lvalue { return $_[0] }
599 sub bad_inc : lvalue { return ${\++$_[0]} }
614 is($blah, 8, "yada");
617 cmp_ok($in, '==', 8);
619 bad_id(bad_get_st) = 10;
620 cmp_ok($blah, '==', 10);
622 bad_id(bad_get_lex) = 10;
623 cmp_ok($in, '==', 10);
625 ++bad_id(bad_get_st);
626 cmp_ok($blah, '==', 11);
628 ++bad_id(bad_get_lex);
629 cmp_ok($in, '==', 11);
631 bad_id1(bad_get_st) = 20;
632 cmp_ok($blah, '==', 20);
634 bad_id1(bad_get_lex) = 20;
635 cmp_ok($in, '==', 20);
637 ++bad_id1(bad_get_st);
638 cmp_ok($blah, '==', 21);
640 ++bad_id1(bad_get_lex);
641 cmp_ok($in, '==', 21);
644 cmp_ok($blah, '==', 22);
646 bad_inc(bad_get_lex);
647 cmp_ok($in, '==', 22);
649 bad_inc(bad_id(bad_get_st));
650 cmp_ok($blah, '==', 23);
652 bad_inc(bad_id(bad_get_lex));
653 cmp_ok($in, '==', 23);
655 ++bad_inc(bad_id1(bad_id(bad_get_st)));
656 cmp_ok($blah, '==', 25);
658 ++bad_inc(bad_id1(bad_id(bad_get_lex)));
659 cmp_ok($in, '==', 25);
665 my $depth = shift//0;
666 if ($depth == 2) { return $to_modify }
667 return &$r($depth+1);
670 is $to_modify, 7, 'recursive lvalue sub';
672 # Recursive with substr [perl #72706]
677 return &$pie($depth) if $depth--;
680 for my $depth (0, 1, 2) {
681 my $value = "Good $depth";
683 &$pie($depth) = $value;
685 is($@, '', "recursive lvalue substr return depth $depth");
687 "value assigned to recursive lvalue substr (depth $depth)");
692 my @arr = qw /one two three/;
694 sub lval_array () : lvalue {@arr}
700 is($line, "zeroonetwothree");
702 sub trythislval { scalar(@_)."x".join "", @_ }
703 is(trythislval(lval_array()), "3xonetwothree");
705 sub changeme { $_[2] = "free" }
706 changeme(lval_array);
707 is("@arr", "one two free");
709 # test again, with explicit return
710 sub rlval_array() : lvalue {return @arr}
711 @arr = qw /one two three/;
716 is($line, "zeroonetwothree");
717 is(trythislval(rlval_array()), "3xonetwothree");
718 changeme(rlval_array);
719 is("@arr", "one two free");
721 # Variations on the same theme, with multiple vars returned
723 sub lval_scalar_array () : lvalue { $scalar, @arr }
724 @arr = qw /one two three/;
726 for (lval_scalar_array) {
729 is($line, "zerohalfonetwothree");
730 is(trythislval(lval_scalar_array()), "4xhalfonetwothree");
731 changeme(lval_scalar_array);
732 is("@arr", "one free three");
734 sub lval_array_scalar () : lvalue { @arr, $scalar }
735 @arr = qw /one two three/;
738 for (lval_array_scalar) {
741 is($line, "zeroonetwothreefour");
742 is(trythislval(lval_array_scalar()), "4xonetwothreefour");
743 changeme(lval_array_scalar);
744 is("@arr", "one two free");
746 # Tests for specific ops not tested above
748 @array2 = qw 'one two free';
749 is join(',', map $_, sub:lvalue{@array2}->()), 'one,two,free',
750 'rv2av in reference context';
751 is join(',', map $_, sub:lvalue{@{\@array2}}->()), 'one,two,free',
752 'rv2av-with-ref in reference context';
754 my %hash = qw[a b c d];
755 like join(',', map $_, sub:lvalue{%hash}->()),
756 qr/^(?:a,b,c,d|c,d,a,b)\z/, 'padhv in reference context';
758 %hash2 = qw[a b c d];
759 like join(',', map $_, sub:lvalue{%hash2}->()),
760 qr/^(?:a,b,c,d|c,d,a,b)\z/, 'rv2hv in reference context';
761 like join(',', map $_, sub:lvalue{%{\%hash2}}->()),
762 qr/^(?:a,b,c,d|c,d,a,b)\z/, 'rv2hv-with-ref in reference context';
767 sub AUTOLOAD :lvalue { *{$AUTOLOAD} };
769 my $foo = bless {},"Foo";
771 $foo->bar = sub { $result = "bar" };
773 is ($result, 'bar', "RT #41550");
776 SKIP: { skip 'no attributes.pm', 1 unless eval 'require attributes';
777 fresh_perl_is(<<'----', <<'====', "lvalue can not be set after definition. [perl #68758]");
782 sub MODIFY_CODE_ATTRIBUTES {}
783 sub foo : lvalue : fr0g;
786 lvalue attribute ignored after the subroutine has been defined at - line 4.
787 lvalue attribute ignored after the subroutine has been defined at - line 6.
788 Can't modify non-lvalue subroutine call in scalar assignment at - line 7, near "3;"
789 Execution of - aborted due to compilation errors.
795 sub lval_decl : lvalue;
798 is($x, 5, "subroutine declared with lvalue before definition retains lvalue. [perl #68758]");
801 SKIP: { skip "no attributes.pm", 2 unless eval { require attributes };
802 sub utf8::valid :lvalue;
804 is "@{[ &attributes::get(\&utf8::valid) ]}", 'lvalue',
805 'sub declaration with :lvalue applies it to XSUBs';
807 BEGIN { *wonky = \&marjibberous }
809 is "@{[ &attributes::get(\&wonky) ]}", 'lvalue',
810 'sub declaration with :lvalue applies it to assigned stub';
813 sub fleen : lvalue { $pnare }
814 $pnare = __PACKAGE__;
815 ok eval { fleen = 1 }, "lvalues can return COWs (CATTLE?) [perl #75656]";\
816 is $pnare, 1, 'and returning CATTLE actually works';
817 $pnare = __PACKAGE__;
818 ok eval { (fleen) = 1 }, "lvalues can return COWs in list context";
819 is $pnare, 1, 'and returning COWs in list context actually works';
820 $pnare = __PACKAGE__;
821 ok eval { $_ = 1 for(fleen); 1 }, "lvalues can return COWs in ref cx";
822 is $pnare, 1, 'and returning COWs in reference context actually works';
825 # Returning an arbitrary expression, not necessarily lvalue
826 +sub :lvalue { return $ambaga || $ambaga }->() = 73;
827 is $ambaga, 73, 'explicit return of arbitrary expression (scalar context)';
828 (sub :lvalue { return $ambaga || $ambaga }->()) = 74;
829 is $ambaga, 74, 'explicit return of arbitrary expression (list context)';
830 +sub :lvalue { $ambaga || $ambaga }->() = 73;
831 is $ambaga, 73, 'implicit return of arbitrary expression (scalar context)';
832 (sub :lvalue { $ambaga || $ambaga }->()) = 74;
833 is $ambaga, 74, 'implicit return of arbitrary expression (list context)';
834 eval { +sub :lvalue { return 3 }->() = 4 };
835 like $@, qr/Can\'t return a readonly value from lvalue subroutine at/,
836 'assignment to numeric constant explicitly returned from lv sub';
837 eval { (sub :lvalue { return 3 }->()) = 4 };
838 like $@, qr/Can\'t return a readonly value from lvalue subroutine at/,
839 'assignment to num constant explicitly returned (list cx)';
840 eval { +sub :lvalue { 3 }->() = 4 };
841 like $@, qr/Can\'t return a readonly value from lvalue subroutine at/,
842 'assignment to numeric constant implicitly returned from lv sub';
843 eval { (sub :lvalue { 3 }->()) = 4 };
844 like $@, qr/Can\'t return a readonly value from lvalue subroutine at/,
845 'assignment to num constant implicitly returned (list cx)';
847 # reference (potential lvalue) context
849 for my $sub (sub :lvalue {$_}, sub :lvalue {return $_}) {
850 &$sub()->${\sub { $_[0] = 37 }};
851 is $_, '37', 'lvalue->method'.$suffix;
852 ${\scalar &$sub()} = 38;
853 is $_, '38', 'scalar(lvalue)'.$suffix;
854 sub assign39_with_proto ($) { $_[0] = 39 }
855 assign39_with_proto(&$sub());
856 is $_, '39', 'func(lvalue) when func has $ proto'.$suffix;
858 ${\(&$sub()||undef)} = 40;
859 is $_, '40', 'lvalue||...'.$suffix;
860 ${\(${\undef}||&$sub())} = 41; # extra ${\...} to bypass const folding
861 is $_, '41', '...||lvalue'.$suffix;
863 ${\(&$sub()&&undef)} = 42;
864 is $_, '42', 'lvalue&&...'.$suffix;
865 ${\(${\1}&&&$sub())} = 43;
866 is $_, '43', '...&&lvalue'.$suffix;
867 ${\(&$sub())[0]} = 44;
868 is $_, '44', '(lvalue)[0]'.$suffix;
870 continue { $suffix = ' (explicit return)' }
874 for my $sub (sub :lvalue {$_}, sub :lvalue {return $_}) {
877 is $_->[3], 4, 'func->[...] autovivification'.$suffix;
880 is $_->{3}, 4, 'func->{...} autovivification'.$suffix;
883 is $$_, 4, '${func()} autovivification' .$suffix;
886 is "@$_", 4, '@{func()} autovivification' .$suffix;
889 is join('-',%$_), '4-5', '%{func()} autovivification'.$suffix;
892 is $$_, 4, '${ (), func()} autovivification' .$suffix;
894 continue { $suffix = ' (explicit return)' }
896 # [perl #92406] [perl #92290] Returning a pad var in rvalue context
899 sub :lvalue { my $x = 72; $x },
900 sub :lvalue { my $x = 72; return $x }
902 is scalar(&$sub), 72, "sub returning pad var in scalar context$suffix";
903 is +(&$sub)[0], 72, "sub returning pad var in list context$suffix";
905 continue { $suffix = ' (explicit return)' }
907 # Returning read-only values in reference context
910 sub :lvalue { $] }->(),
911 sub :lvalue { return $] }->()
913 is \$_, \$], 'read-only values are returned in reference context'
914 .$suffix # (they used to be copied)
916 continue { $suffix = ' (explicit return)' }
918 # Returning unwritables from nested lvalue sub call in in rvalue context
919 # First, ensure we are testing what we think we are:
920 if (!Internals::SvREADONLY($])) { Internals::SvREADONLY($],1); }
921 sub squibble : lvalue { return $] }
922 sub squebble : lvalue { squibble }
923 sub squabble : lvalue { return squibble }
924 is $x = squebble, $], 'returning ro from nested lv sub call in rv cx';
925 is $x = squabble, $], 'explct. returning ro from nested lv sub in rv cx';
926 is \squebble, \$], 'returning ro from nested lv sub call in ref cx';
927 is \squabble, \$], 'explct. returning ro from nested lv sub in ref cx';
929 # [perl #102486] Sub calls as the last statement of an lvalue sub
933 sub strictlv :lvalue { use strict 'refs'; &$x }
934 sub lv :lvalue { &$x }
935 sub nonlv { ++$called }
937 ::like $@, qr/^Can't use string \("nonlv"\) as a subroutine ref while/,
938 'strict mode applies to sub:lvalue{ &$string }';
941 'sub:lvalue{&$x}->() does not die for non-lvalue inner sub call';
942 ::is $called, 1, 'The &$x actually called the sub';
943 eval { +sub :lvalue { &$x }->() = 3 };
944 ::like $@, qr/^Can't modify non-lvalue subroutine call at /,
945 'sub:lvalue{&$x}->() dies in true lvalue context';
948 # TARG should be copied in rvalue context
949 sub ucf :lvalue { ucfirst $_[0] }
950 is ucf("just another ") . ucf("perl hacker,\n"),
951 "Just another Perl hacker,\n", 'TARG is copied in rvalue scalar cx';
952 is join('',ucf("just another "), ucf "perl hacker,\n"),
953 "Just another Perl hacker,\n", 'TARG is copied in rvalue list cx';
955 @_ ? ucfirst $_[0] : do {
956 is ucfr("just another ") . ucfr("perl hacker,\n"),
957 "Just another Perl hacker,\n",
958 'TARG is copied in recursive rvalue scalar cx';
959 is join('',ucfr("just another "), ucfr("perl hacker,\n")),
960 "Just another Perl hacker,\n",
961 'TARG is copied in recursive rvalue list cx';
966 # [perl #117947] XSUBs should not be treated as lvalues at run time
967 eval { &{\&utf8::is_utf8}("") = 3 };
968 like $@, qr/^Can't modify non-lvalue subroutine call at /,
969 'XSUB not seen at compile time dies in lvalue context';