This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow sv_setsv_flags() to copy SVt_REGEXP much like it copies
[perl5.git] / ext / re / re.xs
index 1de1491..ccf8ca0 100644 (file)
@@ -128,9 +128,13 @@ PPCODE:
         } else {
             /* Scalar, so use the string that Perl would return */
             /* return the pattern in (?msix:..) format */
+#if PERL_VERSION >= 11
+            pattern = sv_2mortal(newSVsv((SV*)re));
+#else
             pattern = sv_2mortal(newSVpvn(RX_WRAPPED(re),RX_WRAPLEN(re)));
             if (RX_UTF8(re))
                 SvUTF8_on(pattern);
+#endif
             XPUSHs(pattern);
             XSRETURN(1);
         }