Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Rik
Tue, 11 Aug 1992 20:09
Yet another one
Author: Rik
Date: Tue, 11 Aug 1992 20:09
Date: Tue, 11 Aug 1992 20:09
23 lines
997 bytes
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. :-)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads