This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
C<keys %+> should not warn. Don't make scan_ident test for
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 24 Feb 2007 09:29:20 +0000 (09:29 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Sat, 24 Feb 2007 09:29:20 +0000 (09:29 +0000)
ambiguous unary ops when the following token is a hash identifier.
(like with scalars and arrays)

p4raw-id: //depot/perl@30387

t/lib/warnings/toke
toke.c

index e4fa82c..af27047 100644 (file)
@@ -588,6 +588,11 @@ Warning: Use of "rand" without parentheses is ambiguous at - line 8.
 Warning: Use of "rand" without parentheses is ambiguous at - line 10.
 ########
 # toke.c
+use warnings "ambiguous";
+print for keys %+; # should not warn
+EXPECT
+########
+# toke.c
 sub fred {};
 -fred ;
 EXPECT
diff --git a/toke.c b/toke.c
index 5248d46..89bb87b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -4132,7 +4132,8 @@ Perl_yylex(pTHX)
            Mop(OP_MODULO);
        }
        PL_tokenbuf[0] = '%';
-       s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, TRUE);
+       s = scan_ident(s, PL_bufend, PL_tokenbuf + 1,
+               sizeof PL_tokenbuf - 1, FALSE);
        if (!PL_tokenbuf[1]) {
            PREREF('%');
        }