This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18604] [3.4/4.0/4.1 Regression] Strong using lookup conflicts
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 May 2005 07:25:42 -0000
- Subject: [Bug c++/18604] [3.4/4.0/4.1 Regression] Strong using lookup conflicts
- References: <20041122050208.18604.giovannibajo@libero.it>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2005-05-09 07:25 -------
I analyzed this PR again. The problem seems not related to attribute strong
itself, but rather the way v3 namespaces work. Basically, without debug
support, the failing code looks like:
---------------------------------
namespace std {
struct A {};
};
struct A;
namespace std {
A a; // std::A, OK!
};
---------------------------------
Instead, with debug support, we end up with code like this:
---------------------------------
namespace std {
struct A {};
};
namespace __gnu_norm {
using namespace std;
};
struct A;
namespace __gnu_norm {
A a; // ambiguous!
};
---------------------------------
hence the failure. There are at least two ways to fix this in v3:
- Fully qualify all references to std names from code within namespace
_GLIBCXX_STD (which expands to __gnu_norm in debug mode). This is hard because
it's impossible to fully check it, and it's pervasive. E.g. bits/stl_set.h:69,
use "std::less" instead of "less".
- Define namespace __gnu_norm within namespace std. This could be easier
because you probably have to touch *only* namespace definitions.
Comments?
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkoz at gcc dot gnu dot org,
| |mmitchel at gcc dot gnu dot
| |org, pcarlini at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18604