develooper Front page | perl.perl5.porters | Postings from April 2010

Re: [perl #74114] when(scalar){} -> S_looks_like_bool: Assertion `o' failed.

Thread Previous
From:
Rafael Garcia-Suarez
Date:
April 9, 2010 03:25
Subject:
Re: [perl #74114] when(scalar){} -> S_looks_like_bool: Assertion `o' failed.
Message ID:
r2ob77c1dce1004090325if19fac27w2e37b1142337daea@mail.gmail.com
On 7 April 2010 13:36, Frank Wiegand <perlbug-followup@perl.org> wrote:
>  % perl-5.10.1 -E 'when(scalar){}'
>  Not enough arguments for scalar at -e line 1, near "scalar)"
>  Execution of -e aborted due to compilation errors.
>
>  % perl-5.12.0-RC3 -E 'when(scalar){}'
>  perl-5.12.0-RC3: op.c:5272: S_looks_like_bool: Assertion `o' failed.
>  Aborted

Thanks for the report and the bisect !

Here's a patch that makes it report a syntax error instead. I'll apply
to maint 5.12 when opened.

diff --git a/op.c b/op.c
index 9c94cc8..76eb16f 100644
--- a/op.c
+++ b/op.c
@@ -5282,14 +5282,11 @@ S_looks_like_bool(pTHX_ const OP *o)
             && looks_like_bool(cLOGOPo->op_first->op_sibling));

        case OP_NULL:
+       case OP_SCALAR:
            return (
                o->op_flags & OPf_KIDS
            && looks_like_bool(cUNOPo->op_first));

-        case OP_SCALAR:
-            return looks_like_bool(cUNOPo->op_first);
-
-
        case OP_ENTERSUB:

        case OP_NOT:    case OP_XOR:

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About