This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20687] namespace bug
- From: "jozef at syncad dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Mar 2005 14:56:29 -0000
- Subject: [Bug c++/20687] namespace bug
- References: <20050329171354.20687.jozef@syncad.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jozef at syncad dot com 2005-03-30 14:56 -------
Subject: Re: namespace bug
Hi,
This is not about the same :
7.3.4.5
d1++; // shows that there is a conflict between a symbol in your
// namespace and a symbol imported using using namespace
f(1); // shows that there is a conflict between two symbols;
// both imported from two namespaces; one directly,
// the second transitively
None of the errors indicated show that there is a conflict
between a symbol imported from a namespace and a symbol
from a higher level namespace.
But the example in the first paragraph clearly states that
the imported names hide names from the higher levels:
7.3.4.1
i = 5; // OK, C::i visible in B and hides A::i
7.3.4.5 does not conflict with 7.3.4.1. It still looks
to me reasonable that the names imported using namespace have higher
precedence than names inherited from a higher level namespace
(this would be similar to the fact that the names defined
in a namespace have higher precedence to the names inherited
from a higher level namespaces).
One more argument is that this feature is required to compile correctly STLport.
pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-29 19:51 -------
> The reduced testcase:
> namespace dd {
> struct t1 {};
> }
> namespace ff {
> using namespace dd;
> }
> struct t1 { };
> namespace ff
> {
> typedef t1 t2;
> }
>
>
> But the use of t1 is ambiguous really as "using namespace" is not as strong as defining the t1 in the
> namespace ff or doing a "using dd::t1" in the namespace ff.
>
Can you provide some reference to the standard for this claim, please?
Regards,
Jozef
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20687