Path: utzoo!attcan!uunet!ns-mx!iowasp.physics.uiowa.edu!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!apple!usc!samsung!uak ari.primate.wisc.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpcllla!hpclisp!hpclmao!mao From: mao@hpclmao.HP.COM (Mike Ogush) Newsgroups: comp.lang.c++ Subject: Re: inline member functions returning a enumerated type Message-ID: <58170029@hpclmao.HP.COM> Date: 26 Jul 90 20:47:32 GMT References: <1851@island.uu.net> Organization: Hewlett-Packard Calif. Language Lab Lines: 59 > / hpclmao:comp.lang.c++ / chris@island.uu.net (Chris King) / 10:31 am Jul 23, 1990 / > Hi. > I could use some help figuring out a problem I am having with > defining a inline member function that returns a enum. I don't > understand the compile time error I get when I try to do this. I am > using Sun's version of cfront 2.0. Here is a simple test program > showing the problem and cfronts output. > . Code omitted . > > "TestClass.cc", line 8: error: bad base type: inline enum id > > > Thanks in advance for any help that you can give me. > > > Chris King > Island Graphics Corp. > {sun,ucbcad,uunet}!island!chris > > ---------- I this out on HPs C++ compiler and got the same result. I suspect that the parser objects to "inline enum id" as a valid type. In any case, I modified your code to rename the "enum id" type using typedef and the code compiled fine. Fixed version: struct test { typedef enum id { A, B, C } ID; ID v; test() { v = A; } inline ID GetV() { return v; } }; main() { test t; ID V = t.GetV(); } -- Mike Ogush California Language Laboratory Systems Technology Division Hewlett-Packard Company ...!hplabs!hpclmao!mao or mao%hpclmao@hplabs.hp.com