$tail .= $taint if defined $tail; # avoid warning if $tail == undef
wantarray ? ($basename .= $taint, $dirpath .= $taint, $tail)
- : $basename .= $taint;
+ : ($basename .= $taint);
}
return first;
}
}
- else if (first->op_type == OP_WANTARRAY) {
- /* XXX true only if this result will be returned, else should
- propagate outer context */
- if (type == OP_AND)
- list(other);
- else
- scalar(other);
- }
else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS)) {
OP *k1 = ((UNOP*)first)->op_first;
OP *k2 = k1->op_sibling;
return falseop;
}
}
- else if (first->op_type == OP_WANTARRAY) {
- /* XXX true only if this result will be returned, else should
- propagate outer context */
- list(trueop);
- scalar(falseop);
- }
NewOp(1101, logop, 1, LOGOP);
logop->op_type = OP_COND_EXPR;
logop->op_ppaddr = PL_ppaddr[OP_COND_EXPR];
#!./perl
-print "1..7\n";
+print "1..9\n";
sub context {
my ( $cona, $testnum ) = @_;
my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
$a = scalar context('S',5);
($a) = context('A',6);
($a) = scalar context('S',7);
+
+{
+ # [ID 20020626.011] incorrect wantarray optimisation
+ sub simple { wantarray ? 1 : 2 }
+ sub inline {
+ my $a = wantarray ? simple() : simple();
+ $a;
+ }
+ my @b = inline();
+ my $c = inline();
+ print +(@b == 1 && "@b" eq "2") ? "ok 8\n" : "not ok 8\t# <@b>\n";
+ print +($c == 2) ? "ok 9\n" : "not ok 9\t# <$c>\n";
+}
+
1;