This is something I failed to change in commit ce0d59f. I don’t know
of a way to trigger this in pure-Perl code, hence the use of XS in
the test. It did show up in pure-Perl code due to a bug fixed by the
previous commit.
SV *
newRV(SV *sv)
+void
+alias_av(AV *av, IV ix, SV *sv)
+ CODE:
+ av_store(av, ix, SvREFCNT_inc(sv));
+
MODULE = XS::APItest PACKAGE = XS::APItest::AUTOLOADtest
int
LvTARG(sv) = NULL; /* array can't be extended */
else {
SV* const * const svp = av_fetch(av, LvSTARGOFF(sv), TRUE);
- if (!svp || (value = *svp) == &PL_sv_undef)
+ if (!svp || !(value = *svp))
Perl_croak(aTHX_ PL_no_aelem, LvSTARGOFF(sv));
}
}
require "test.pl";
}
-plan(105);
+plan(106);
# A lot of tests to check that reversed for works.
is eval { \$_ }, \undef, 'foreach (@array_containing_undef)'
}
}->(undef);
+
+SKIP: {
+ skip "No XS::APItest under miniperl", 1, if is_miniperl;
+ my @a;
+ sub {
+ require XS::APItest;
+ XS::APItest::alias_av(\@a, 0, undef);
+ eval { \$_[0] }
+ }->($a[0]);
+ is $@, "", 'vivify_defelem does not croak on &PL_sv_undef elements';
+}