This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Inconsistent arithmetics on refs
authorStephen McCamant <smcc@mit.edu>
Mon, 6 Jul 1998 21:22:17 +0000 (16:22 -0500)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 7 Jul 1998 22:13:11 +0000 (22:13 +0000)
Message-ID: <13729.33816.311236.995647@alias-2.pr.mcs.net>

p4raw-id: //depot/perl@1361

sv.c

diff --git a/sv.c b/sv.c
index 0ff19a2..f37989e 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3442,10 +3442,13 @@ sv_inc(register SV *sv)
                croak(no_modify);
        }
        if (SvROK(sv)) {
+           IV i;
 #ifdef OVERLOAD
-         if (SvAMAGIC(sv) && AMG_CALLun(sv,inc)) return;
+           if (SvAMAGIC(sv) && AMG_CALLun(sv,inc)) return;
 #endif /* OVERLOAD */
-         sv_unref(sv);
+           i = (IV)SvRV(sv);
+           sv_unref(sv);
+           sv_setiv(sv, i);
        }
     }
     if (SvGMAGICAL(sv))
@@ -3519,10 +3522,13 @@ sv_dec(register SV *sv)
                croak(no_modify);
        }
        if (SvROK(sv)) {
+           IV i;
 #ifdef OVERLOAD
-         if (SvAMAGIC(sv) && AMG_CALLun(sv,dec)) return;
+           if (SvAMAGIC(sv) && AMG_CALLun(sv,dec)) return;
 #endif /* OVERLOAD */
-         sv_unref(sv);
+           i = (IV)SvRV(sv);
+           sv_unref(sv);
+           sv_setiv(sv, i);
        }
     }
     if (SvGMAGICAL(sv))