From: Gurusamy Sarathy Date: Wed, 31 May 2000 05:01:47 +0000 (+0000) Subject: scalar() doesn't force scalar context when used in void context X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d64830355c411305652aeae96623a3ca530d6d38;p=p5sagit%2Fp5-mst-13.2.git scalar() doesn't force scalar context when used in void context (from Simon Cozens) p4raw-id: //depot/perl@6171 --- diff --git a/op.c b/op.c index c7da1c5..57b35ea 100644 --- a/op.c +++ b/op.c @@ -1165,7 +1165,6 @@ Perl_scalarvoid(pTHX_ OP *o) case OP_DBSTATE: case OP_ENTERTRY: case OP_ENTER: - case OP_SCALAR: if (!(o->op_flags & OPf_KIDS)) break; /* FALL THROUGH */ @@ -1184,6 +1183,8 @@ Perl_scalarvoid(pTHX_ OP *o) case OP_REQUIRE: /* all requires must return a boolean value */ o->op_flags &= ~OPf_WANT; + /* FALL THROUGH */ + case OP_SCALAR: return scalar(o); case OP_SPLIT: if ((kid = cLISTOPo->op_first) && kid->op_type == OP_PUSHRE) { diff --git a/t/op/wantarray.t b/t/op/wantarray.t index 0a47b6d..4b6f37c 100755 --- a/t/op/wantarray.t +++ b/t/op/wantarray.t @@ -1,6 +1,6 @@ #!./perl -print "1..3\n"; +print "1..7\n"; sub context { my ( $cona, $testnum ) = @_; my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V'; @@ -13,4 +13,8 @@ sub context { context('V',1); $a = context('S',2); @a = context('A',3); +scalar context('S',4); +$a = scalar context('S',5); +($a) = context('A',6); +($a) = scalar context('S',7); 1;