Enum in namespace

Gonsolo gonsolo@gmail.com
Thu Mar 6 13:28:00 GMT 2008


Hi!

namespace A {
	enum A {
	        x
	};
}

void f()
{
         A::A a;
         using namespace A;
         a = x;
}

works whereas

namespace A {
	enum A {
	        x
	};
}

void f()
{
         using namespace A;
         A::A a;
         a = x;
}

gives the following error:

test.cc: In function 'void f()':
test.cc:10: error: reference to 'A' is ambiguous
test.cc:1: error: candidates are: namespace A { }
test.cc:2: error:                 enum A::A

Since A::A is fully qualified it should be clear that the first A is the 
namespace and the second the enum.
Is this a bug or am I too demanding?

Thanks,

G



More information about the Gcc mailing list