check the void context fix for sv_numeq too

This commit is contained in:
Tony Cook 2025-12-11 14:06:41 +11:00
parent 1840104512
commit b5f41adca0
2 changed files with 15 additions and 1 deletions

View File

@ -5055,6 +5055,14 @@ sv_numeq_flags(nullable_SV sv1, nullable_SV sv2, U32 flags)
OUTPUT:
RETVAL
# deliberately void context
void
void_sv_numeq(nullable_SV sv1, nullable_SV sv2, SV *out)
CODE:
sv_setbool(out, sv_numeq(sv1, sv2));
OUTPUT:
out
bool
sv_numne(nullable_SV sv1, nullable_SV sv2)

View File

@ -1,6 +1,6 @@
#!perl
use Test::More tests => 23;
use Test::More tests => 25;
use XS::APItest;
use Config;
@ -48,6 +48,12 @@ ok sv_numeq_flags($1, 10, SV_GMAGIC), 'sv_numeq_flags with SV_GMAGIC does';
ok !sv_numeq_flags($obj, 10, SV_SKIP_OVERLOAD), 'AlwaysTen is not 10 with SV_SKIP_OVERLOAD';
ok !sv_numeq_flags($obj, 123456, SV_SKIP_OVERLOAD), 'AlwaysTen is not its overloaded numeric value with SV_SKIP_OVERLOAD';
my $result;
void_sv_numeq($obj, 10, $result);
ok($result, "overloaded sv_numeq() (eq) in void context");
void_sv_numeq($obj, 12, $result);
ok(!$result, "overloaded sv_numeq() (ne) in void context");
}
# +0 overloading with large numbers and using fallback