Article View: gnu.g++.bug
Article #884no subject (file transmission)
From: Peter Cass
Date: Wed, 02 Sep 1992 20:55
Date: Wed, 02 Sep 1992 20:55
37 lines
1123 bytes
1123 bytes
class nut {
public:
enum NUTTYPES {walnut, peanut} _type;
int is_walnut(){return _type == walnut; }
NUTTYPES type() { return _type; }
nut() { _type = peanut; }
};
main()
{
nut *peanut;
char *str;
peanut = new nut;
// Saber-C++ compiles without complaint ...
// gcc fails with message:
// foo.C: In function `int main ()':
// foo.C:22: assignment between incompatible pointer types
str = (peanut->type()==nut::walnut ? "yes" :
(peanut->is_walnut() ? "maybe" : "no"));
// OK
str = peanut->type()==nut::walnut ? "yes" : "no";
// OK
if (peanut->type()==nut::walnut)
str = "yes";
else if (peanut->is_walnut())
str = "maybe";
else
str = "no";
}
// Compiled on Sun4 running SunOS 4.1.2
Technical Details
Message-ID:
<9209022054.AA23469@ctnet>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!curtech.UUCP!pfcShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!curtech.UUCP!pfc From: pfc@curtech.UUCP (Peter Cass) Subject: no subject (file transmission) Message-ID: <9209022054.AA23469@ctnet> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 2 Sep 1992 20:55:50 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 38