public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity
@ 2014-04-22 21:31 filip.roseen at gmail dot com
2014-04-22 22:27 ` [Bug c++/60927] " mbos at google dot com
2014-12-14 14:54 ` ville.voutilainen at gmail dot com
0 siblings, 2 replies; 3+ messages in thread
From: filip.roseen at gmail dot com @ 2014-04-22 21:31 UTC (permalink / raw)
To: gcc-bugs
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. ]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60927] Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity
2014-04-22 21:31 [Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity filip.roseen at gmail dot com
@ 2014-04-22 22:27 ` mbos at google dot com
2014-12-14 14:54 ` ville.voutilainen at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: mbos at google dot com @ 2014-04-22 22:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60927
Maurice Bos <mbos at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mbos at google dot com
--- Comment #1 from Maurice Bos <mbos at google dot com> ---
Some interesting related test cases:
namespace N { struct A {}; }
namespace A {}
using namespace N;
A * x;
int main() {}
G++ correctly complains about ambiguity. When the two lines with 'N' are
removed, it complains that A is not a type. (As expected.)
Very similar test case:
#include <memory>
namespace N { struct A {}; }
namespace A {}
using namespace N;
std::unique_ptr<A> x; // Only this line is different.
int main() {}
G++ does not complain about ambiguity, but gives the same error as when the two
lines with 'N' are removed.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/60927] Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity
2014-04-22 21:31 [Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity filip.roseen at gmail dot com
2014-04-22 22:27 ` [Bug c++/60927] " mbos at google dot com
@ 2014-12-14 14:54 ` ville.voutilainen at gmail dot com
1 sibling, 0 replies; 3+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14 14:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60927
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-14
CC| |ville.voutilainen at gmail dot com
Ever confirmed|0 |1
Known to fail| |4.8.2, 4.9.1, 5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-14 14:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22 21:31 [Bug c++/60927] New: Ambiguity not caught when name introduced through using-directive conflicts with previously declared entity filip.roseen at gmail dot com
2014-04-22 22:27 ` [Bug c++/60927] " mbos at google dot com
2014-12-14 14:54 ` ville.voutilainen at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).