14 local $::Level = $::Level + 1;
15 my ( $cona, $name ) = @_;
16 my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
17 is $conb, $cona, $name;
24 $a = scalar context('S');
26 ($a) = scalar context('S');
29 # [ID 20020626.011 (#9998)] incorrect wantarray optimisation
30 sub simple { wantarray ? 1 : 2 }
32 my $a = wantarray ? simple() : simple();
45 $q = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
54 # Test with various ops that the right context is used at the end of a sub-
55 # routine (run-time context).
59 sub or_context { $::f || context(shift, "rhs of || at sub exit") }
63 sub and_context { $::t && context(shift, "rhs of && at sub exit") }
65 $_ = and_context('S');
66 () = and_context('A');
67 sub dor_context { $::u // context(shift, "rhs of // at sub exit") }
69 $_ = dor_context('S');
70 () = dor_context('A');
71 sub cond_middle_cx { $::t ? context(shift, "mid of ?: at sub exit") : 0 }
73 $_ = cond_middle_cx('S');
74 () = cond_middle_cx('A');
75 sub cond_rhs_cx { $::f ? 0 : context(shift, "rhs of ?: at sub exit") }
77 $_ = cond_rhs_cx('S');
78 () = cond_rhs_cx('A');