This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
C++ question - forward declaration for enum?
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 04 Oct 2003 16:04:23 -0500
- Subject: C++ question - forward declaration for enum?
- References: <" <4E85E49D1F0CBF4F96EA08E335750D7D0718C04C"@Esealnt877.al.sw.ericsson.se>
Hi everyone,
Here's the offending code:
class X
{
int m;
public:
X(type i) : m(i) { }
enum type { one, two, three };
};
Aww, gee... the compiler doesn't like it. (The above code causes GCC 3.1 to SEGV! GCC 3.3.1 merely complains.) When it hits the constructor, it doesn't know what the heck "type" is.
Is there a forward declaration? Any proper C++ way to use the enum "type" before the full declaration of enum "type"?
Thanks,
--Eljay