Compile error: classes and typedefs

Harri Porten porten@tu-harburg.de
Thu Jun 17 19:14:00 GMT 1999


Hi !

When trying to compile the attached C++ code with gcc-2.95 19990608
(i586-pc-linux-gnu system) I get the following error:

color.cpp: In function `int main(int, char **)':
color.cpp:15: redeclaration of `class Obj Int'
color.cpp:15: `class Obj Int' previously declared here

Isn't that strange ? Or is the code illegal ? Other compilers are happy
with it.

Harri.

===============================================

typedef int Int;

class Obj {
public:
  Obj(int) {};
};

class Group {
public:
  Group(const Obj &, const Obj &) {};
};

int main(int, char **)
{
  Group group(Obj(Int(1)), Obj(Int(1)));
}


More information about the Gcc-bugs mailing list