Path: utzoo!attcan!uunet!munnari!vuwcomp!windy!srwmrbd From: srwmrbd@windy.dsir.govt.nz (ROBERT) Newsgroups: comp.lang.c++ Subject: zortech bug Message-ID: <2291@windy.dsir.govt.nz> Date: 16 Apr 89 16:23:26 GMT Sender: SRWHNEW@wnv.dsir.govt.nz Organization: DSIR, Wellington, NZ Lines: 29 // example of incorrect output from zortech version 1.07 // when << is extended to structures #ifdef ZORTECH #include #else #include #endif class ExtInt { int value; public: ExtInt operator+(ExtInt&); friend ostream& operator<<( ostream&, ExtInt& ); ExtInt(int v) { value=v; } }; main() { ExtInt a1=15; ExtInt a2=3; cout << a1 <<" "<< a2 <<"\n"; cout << a1+a1 <<" "<< a1+a2 <<"\n"; // produces incorrect output cout << a1+a1 <<" "; cout << a1+a2 <<"\n"; // produces correct output } ExtInt ExtInt::operator+(ExtInt& er) { return ExtInt(value+er.value); } ostream& operator<<(ostream& os, ExtInt& er) { os << er.value; return os; }