http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60927
Bug ID: 60927
Summary: Ambiguity not caught when name introduced through
using-directive conflicts with previously declared
entity
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: filip.roseen at gmail dot com
Created attachment 32656
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32656&action=edit
testcase.cpp
namespace N {
namespace A {
int x = 1;
}
}
struct A {
static int x;
};
int main () {
using namespace N;
A::x = 123;
}
----------------------------------------------------
`gcc` accepts the above even though there's an ambiguity between `N::A::x` and
`A::x` when referenced as `A::x` in `main`.
------------------------------------------------------
[ note: `gcc` treats the `A::x` as referring to `N::A::x`. ]
[ note: `clang` shows the correct behaviour and issues a diagnostic saying that
`A::x` is ambiguous. ]