This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #119501] \(1+2) always referencing the same sv
[perl5.git] / op.c
diff --git a/op.c b/op.c
index 2008cf1..f2a575c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3347,6 +3347,11 @@ S_fold_constants(pTHX_ OP *o)
        break;
     case OP_REPEAT:
        if (o->op_private & OPpREPEAT_DOLIST) goto nope;
+       break;
+    case OP_SREFGEN:
+       if (cUNOPx(cUNOPo->op_first)->op_first->op_type != OP_CONST
+        || SvPADTMP(cSVOPx_sv(cUNOPx(cUNOPo->op_first)->op_first)))
+           goto nope;
     }
 
     if (PL_parser && PL_parser->error_count)