Change 13881 by jhi@alpha on 2001/12/24 23:47:53

        Subject: PATCH: Restore "Can't declare scalar dereference in my" error
        From: Mark-Jason Dominus <[EMAIL PROTECTED]>    
        Date: Mon, 24 Dec 2001 18:14:48 -0500
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/op.c#466 edit
.... //depot/perl/t/op/eval.t#19 edit

Differences ...

==== //depot/perl/op.c#466 (text) ====
Index: perl/op.c
--- perl/op.c.~1~       Mon Dec 24 17:00:06 2001
+++ perl/op.c   Mon Dec 24 17:00:06 2001
@@ -2043,6 +2043,9 @@
     } else if (type == OP_RV2SV ||     /* "our" declaration */
               type == OP_RV2AV ||
               type == OP_RV2HV) { /* XXX does this let anything illegal in? */
+      if (cUNOPo->op_first->op_type != OP_GV) { /* MJD 20011224 */
+           yyerror(form("Can't declare %s in my", OP_DESC(o)));
+        }
         if (attrs) {
             GV *gv = cGVOPx_gv(cUNOPo->op_first);
             PL_in_my = FALSE;

==== //depot/perl/t/op/eval.t#19 (xtext) ====
Index: perl/t/op/eval.t
--- perl/t/op/eval.t.~1~        Mon Dec 24 17:00:06 2001
+++ perl/t/op/eval.t    Mon Dec 24 17:00:06 2001
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..41\n";
+print "1..45\n";
 
 eval 'print "ok 1\n";';
 
@@ -221,3 +221,16 @@
     };
     print "not ok 41\n" if $@;
 }
+
+# Make sure that "my $$x" is forbidden
+# 20011224 MJD
+{
+  eval q{my $$x};
+  print $@ ? "ok 42\n" : "not ok 42\n";
+  eval q{my @$x};
+  print $@ ? "ok 43\n" : "not ok 43\n";
+  eval q{my %$x};
+  print $@ ? "ok 44\n" : "not ok 44\n";
+  eval q{my $$$x};
+  print $@ ? "ok 45\n" : "not ok 45\n";
+}
End of Patch.

Reply via email to