This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

enum scoping?


The attached source code generates an error with gcc 3.01 and the
latest CVS code.  My question is.. should it?  Is it legal C++?

If it isn't, why does enabling the typedef enum portion fix the problem?

Thanks!
	-Sam Lantinga, Software Engineer, Blizzard Entertainment

enum foo {
    a,
};

namespace One {

enum foo {
    b,
};

}

using namespace One;

namespace Two {

#if 1
enum foo {
    c,
};
#else
typedef enum {
    c,
} foo;
#endif

}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]