According to this link
A point from C++0x draft : n3290
Shall this program is correct ?
EX:
namespace X {};
enum Foo
{
X = 0, #1
Y,
Z = X // X refers to the enum, not the type
};
Iam getting error while execution this program like // #1 ‘X’ redeclared as different kind of symbol
But in the above statement link …namespace scopes containing the enum-specifier. …etc
please clarify my doubt.
Otherwise Please any one give me an example that proves the above statement(in link) with namespace
There is a difference in that the original question had a
struct Xinstead ofnamespace X. The namespace name is visible in this scope, and so is Foo::X as enum names “leak” into the surrounding namespace. That creates a conflict.In C (and therefore also in C++) the name of a struct/class/union is in a separate “tag namespace” (a C term with a different meaning) which allows us to declare another item using the same name in the same scope:
Difference between 'struct' and 'typedef struct' in C++?