This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
reparse compile-time /(?{})/ in right scope
authorDavid Mitchell <davem@iabyn.com>
Tue, 6 Aug 2013 15:34:50 +0000 (16:34 +0100)
committerDavid Mitchell <davem@iabyn.com>
Tue, 6 Aug 2013 15:44:12 +0000 (16:44 +0100)
commitc3923c33af542d8764d5a1e4eb5d7b311f443b89
treec39cf200d52272b7cde8931a59fed40bc1fd4c7f
parent11609d9c96f9c025675f6215051ab94d6735ddd9
reparse compile-time /(?{})/ in right scope

When a compile-time regex like /...(?{ code-block }) .../
is compiled in the presence of constant and concat overloading,
this can cause (still at compile-time) for the pattern to be evaled and
re-compiled, in order to re-compile any code-blocks that got messed up
during the overloading and thus whose text no longer matches that which
the perl parser previously compiled.

When this happens, eval_sv() happens to be called when the perl parser is
still in compiling state; normally its called from running state.
This tickles an undiscovered bug in Perl_find_runcv_where(), which
finds the current cop sequence by looking at PL_curcop->cop_seq.
At compile time, we need to get it from PL_cop_seqmax instead.
pp_ctl.c
t/re/overload.t