allow $foo{$x} and $bar[$i] for (\$) prototype
authorGurusamy Sarathy <gsar@cpan.org>
Sat, 17 Jul 1999 19:12:33 +0000 (19:12 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sat, 17 Jul 1999 19:12:33 +0000 (19:12 +0000)
p4raw-id: //depot/perl@3681

op.c
t/comp/proto.t

diff --git a/op.c b/op.c
index ae6297c..b605e66 100644 (file)
--- a/op.c
+++ b/op.c
@@ -5548,6 +5548,8 @@ Perl_ck_subr(pTHX_ OP *o)
                case '$':
                    if (o2->op_type != OP_RV2SV
                        && o2->op_type != OP_PADSV
+                       && o2->op_type != OP_HELEM
+                       && o2->op_type != OP_AELEM
                        && o2->op_type != OP_THREADSV)
                    {
                        bad_type(arg, "scalar", gv_ename(namegv), o2);
index 6d60342..ecfbec6 100755 (executable)
@@ -16,7 +16,7 @@ BEGIN {
 
 use strict;
 
-print "1..100\n";
+print "1..107\n";
 
 my $i = 1;
 
@@ -448,11 +448,21 @@ star2 $star, $star, sub { print "ok $i\n"
 star2($star, $star, sub { print "ok $i\n"
                        if $_[0] eq 'FOO' and $_[1] eq 'FOO' }); $i++;
 star2 *FOO, *BAR, sub { print "ok $i\n"
-                       if $_[0] eq \*FOO and $_[0] eq \*BAR }; $i++;
+                       if $_[0] eq \*FOO and $_[1] eq \*BAR }; $i++;
 star2(*FOO, *BAR, sub { print "ok $i\n"
-                       if $_[0] eq \*FOO and $_[0] eq \*BAR }); $i++;
+                       if $_[0] eq \*FOO and $_[1] eq \*BAR }); $i++;
 star2 \*FOO, \*BAR, sub { no strict 'refs'; print "ok $i\n"
-                       if $_[0] eq \*{'FOO'} and $_[0] eq \*{'BAR'} }; $i++;
+                       if $_[0] eq \*{'FOO'} and $_[1] eq \*{'BAR'} }; $i++;
 star2(\*FOO, \*BAR, sub { no strict 'refs'; print "ok $i\n"
-                       if $_[0] eq \*{'FOO'} and $_[0] eq \*{'BAR'} }); $i++;
+                       if $_[0] eq \*{'FOO'} and $_[1] eq \*{'BAR'} }); $i++;
 
+# test scalarref prototype
+sub sreftest (\$$) {
+    print "ok $_[1]\n" if ref $_[0];
+}
+{
+    no strict 'vars';
+    sreftest my $sref, $i++;
+    sreftest($helem{$i}, $i++);
+    sreftest $aelem[0], $i++;
+}