This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Enum in namespace
- From: Gonsolo <gonsolo at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 06 Mar 2008 14:27:58 +0100
- Subject: Enum in namespace
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