🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #923

Yet another one

#923
From: Rik
Date: Tue, 11 Aug 1992 20:09
23 lines
997 bytes
>From Reference manual r.13.4.7  Increment & decrement :

class X {
   public: X operator++() { a=2 ; return *this ;} 
           X operator++(int) { a=5 ; return *this ;}
           int a ;
};

main () {
   X var ;
   ++var ;
   printf("%d\n",var.a) ;
   var++ ;
   printf("%d\n",var.a) ;
}

Prints 2 twice. Replace the postincrement call var++ with var.operator++(0)
and it works.

> Richard Eyre-Todd.  Department of Computer Science, University of Edinburgh.

> Email: ret@uk.ac.ed.dcs                     | Solid fuel is for camp-fires,
> or     ret%dcs.ed.ac.uk@nsfnet-relay.ac.uk  | not boosting Space Shuttles. :-)
Technical Details
Message-ID: <4118.9208112009@garay.dcs.ed.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!dcs.ed.ac.UK!ret

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!dcs.ed.ac.UK!ret
From: ret@dcs.ed.ac.UK (Rik)
Subject: Yet another one
Message-ID: <4118.9208112009@garay.dcs.ed.ac.uk>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 11 Aug 1992 20:09:32 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 24