Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!rutgers!mcnc!thorin!cassatt.cs.unc.edu!leech From: leech@cassatt.cs.unc.edu Newsgroups: comp.lang.c++ Subject: scoping problem with operator<< ? Message-ID: <16322@thorin.cs.unc.edu> Date: 26 Sep 90 22:49:08 GMT Sender: news@thorin.cs.unc.edu Reply-To: leech@cassatt.cs.unc.edu () Organization: University Of North Carolina, Chapel Hill Lines: 35 Expires: References: Sender: Followup-To: Keywords: I've encountered a problem having to do with the scope at which an output operator is declared, which appears to be a cfront bug. Commentary would be appreciated. This is using AT&T C++ 2.0 6/30/89, or Sun C++ 2.0. The problem does not occur with g++ 1.36.1. Sample code is: #include class Anyptr { }; #if !BUG extern ostream &operator<<(ostream &o, Anyptr &s); #endif main() { #if BUG extern ostream &operator<<(ostream &o, Anyptr &s); #endif Anyptr a; cout << a; } No errors occur if compiled without -DBUG; compiling with -DBUG produces the error message: "tst.c", line 16: error: bad operand types ostream_withassign Anyptr for << -- Jon Leech (leech@cs.unc.edu) __@/ UNDERWHELMING OFFER OF THE MONTH: "Please feel free to skip the payment on this month's statement. Normal finance charges will apply." - NCNB VISA