This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [NL-PM] Fw: [PATCH - provisional] H. Merijn Brands idea of buffer numbering.
[perl5.git] / regcomp.c
index 27063a7..c526c3a 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -5609,7 +5609,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth)
            if (!SIZE_ONLY ){
                if (!RExC_nestroot) 
                    RExC_nestroot = parno;
-               if (RExC_seen & REG_SEEN_RECURSE) {
+               if (RExC_seen & REG_SEEN_RECURSE
+                   && !RExC_open_parens[parno-1])
+               {
                    DEBUG_OPTIMISE_MORE_r(PerlIO_printf(Perl_debug_log,
                        "Setting open paren #%"IVdf" to %d\n", 
                        (IV)parno, REG_NODE_NUM(ret)));