This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity
- From: "filip.roseen at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 Apr 2014 21:31:07 +0000
- Subject: [Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity
- Auto-submitted: auto-generated
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. ]