[Bug c++/26448] New: unnecessary namespace-alias ambiguity
namespace lib1 { namespace part { typedef int result; } } namespace lib2 { namespace part = lib1::part; } using namespace lib1; using namespace lib2; int main() { part::result val = 0; return val; } The above code results in a compilation error, "error: `part' has not been declared", but should it really? I can't say the parts of the C++ standard I've read has been clear on the point, but it seems reasonable that the compiler should recognize that "part" is not ambiguous in this case. -- Summary: unnecessary namespace-alias ambiguity Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: emilp at mac dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26448
[Bug c++/26448] unnecessary namespace-alias ambiguity
--- Comment #2 from emilp at mac dot com 2006-03-08 08:45 --- But isn't this problem already solved for the "using" directive. The code below compiles fine and works as expected. In fact, in the days of gcc 3, "using" could be used for namespaces and behaved exactly the way I would prefer. namespace lib1 { typedef int integer; } namespace lib2 { using lib1::integer; } using namespace lib1; using namespace lib2; int main() { integer val = 0; return val; } It seems limiting to introduce new (and often obscure) ambiguities when using namespace aliases, the very problem namespaces are meant to alleviate... E. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26448
[Bug c++/26448] unnecessary namespace-alias ambiguity
--- Comment #4 from emilp at mac dot com 2006-03-08 15:23 --- I did come on a bit strong, didn't I? Sorry about that, I'm just a bit frustrated since it used to work better in the gcc 3 series :-) Do you have a suggestion as to where I could continue this discussion? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26448
[Bug c++/26448] unnecessary namespace-alias ambiguity
--- Comment #6 from emilp at mac dot com 2006-03-08 16:47 --- I'm considering filing a defect report (for a standard clarification) to the commitee but I would like to make sure I'm not climbing any trees here... In your first reply you said "My understanding is that this code is in fact invalid...", which part of the C++ standard did you base this on? I'm just wondering because section 7.3.2 seems not to mention any lookup rules at all? Am I missing something obvious? E. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26448