Make ++ handle regexps and vstrings
authorFather Chrysostomos <sprout@cpan.org>
Sat, 10 Aug 2013 17:38:08 +0000 (10:38 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 11 Aug 2013 17:53:34 +0000 (10:53 -0700)
commit376ccf8b794f87b0c0a827bdcadc14b71179ff42
treeca5af59b5dad785ca07cdf8bfe0e7b72138960f5
parent9bcf803b59623c817fbac6643ae044e77b2a5f38
Make ++ handle regexps and vstrings

$ ./perl -Ilib -e 'use Devel::Peek; $x = v97; ++$x; Dump $x'
SV = PVMG(0x7fbfa402b698) at 0x7fbfa402eed8
  REFCNT = 1
  FLAGS = (RMG,POK,pPOK)
  IV = 0
  NV = 0
  PV = 0x7fbfa3c066a8 "b"\0
  CUR = 1
  LEN = 24
  MAGIC = 0x7fbfa3c06348
    MG_VIRTUAL = 0
    MG_TYPE = PERL_MAGIC_vstring(V)
    MG_LEN = 3
    MG_PTR = 0x7fbfa3c13ee8 "v97"

The vstring magic is still attached (with something that does not
match the contents of the string), even after modifying it.  I
probably broke that in 5.18 after fixing it in 5.16, but I am too
lazy to check.

$ ./perl -le '$x = ${qr//}; $x++; print "$x"'
Assertion failed: (PL_valid_types_IVX[SvTYPE(_svivx) & SVt_MASK]), function Perl_sv_2pv_flags, file sv.c, line 2908.
Abort trap: 6

That I broke when I stopped regexps from being POK in perl 5.18.0.

It was creating a corrupt SV by setting the IOK flag on something of
type SVt_REGEXP.
sv.c
t/op/inc.t