(*up*grades. Or croak)
p4raw-id: //depot/perl@24885
if (SvTYPE(sv) == mt)
return;
+ if (SvTYPE(sv) > mt)
+ croak ("sv_upgrade from type %d down to type %d", SvTYPE(sv), mt);
+
pv = NULL;
cur = 0;
len = 0;
if (!(flags & SVp_POK) || !*SvPVX_const(sv)) {
if ((flags & SVTYPEMASK) < SVt_PVIV)
- sv_upgrade(sv, SVt_IV);
+ sv_upgrade(sv, ((flags & SVTYPEMASK) > SVt_IV ? SVt_PVIV : SVt_IV));
(void)SvIOK_only(sv);
SvIV_set(sv, 1);
return;