Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!ukc!newcastle.ac.uk!cabernet!graham From: graham@cabernet.newcastle.ac.uk (Graham D. Parrington) Newsgroups: comp.lang.c++ Subject: Another cfront 2.0 enum handling bug Message-ID: <1989Dec1.153551.28059@newcastle.ac.uk> Date: 1 Dec 89 15:35:51 GMT Sender: news@newcastle.ac.uk Organization: Computing Laboratory, U of Newcastle upon Tyne, UK NE17RU Lines: 37 Here's another funny in cfront 2.0's handling of enum types. Consider the following little program: #include enum en1 { val1, val2 }; inline ostream& operator<< ( ostream& s, en1 v ) { s << ( v == val1 ? "val1" : "val2") << "\n"; return s; } main () { cout << val1 << "\n"; } When compiled and executed this produces the output: 0 Thats the value of the enum as an int - the inline operator for the type is not used. However if the line with cout in it is replaced by cout << "" << val1 << "\n"; Then the output is the expected: val1 What's going on here? It's really puzzling -- Graham Parrington, Computing Laboratory, University of Newcastle upon Tyne ARPA = Graham.Parrington%newcastle.ac.uk@nsfnet-relay.ac.uk UUCP = ...!ukc!newcastle.ac.uk!Graham.Parrington PHONE = +44 91 222 8067