This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix assert fail when fetching pos clobbers ref with undef
authorFather Chrysostomos <sprout@cpan.org>
Fri, 26 Jul 2013 08:26:54 +0000 (01:26 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 25 Aug 2013 19:25:23 +0000 (12:25 -0700)
commit35995e5cabcbf47f272bbb0fb290908515c1d776
tree4ac6fe162e158e5b465168b2e628ab2d5cdefd29
parent232af1f839acc29d9ac336d13ff67802d236c38b
Fix assert fail when fetching pos clobbers ref with undef

pos($x) returns a special magical scalar that sets the match position
on $x.  Calling pos($x) twice will provide two such scalars.  If we
set one of them to a reference, set the other to undef, and then read
the first, all hail breaks loose, because of the use of SvOK_off.

SvOK_off is not sufficient if arbitrary values can be assigned by Perl
code.  Globs, refs and regexps (among others) need special handling,
which sv_setsv knows how to do.
mg.c
t/op/pos.t