namespace alias and using directive

Martin v. Loewis martin@mira.isdn.cs.tu-berlin.de
Mon Feb 22 15:41:00 GMT 1999


> Is this a bug, or more C++ namespace weirdness?

I'd say this is a bug. Here is a patch.

Thanks,
Martin

1999-02-22  Martin von Loewis  <loewis@informatik.hu-berlin.de>

	* decl.c (lookup_namespace_name): Resolve namespace aliases.

//Build don't link:
namespace A{
  namespace B{int i;}
  using namespace B;
}

namespace C=A;

void f(){
  C::i = 1;
}

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.312
diff -u -p -r1.312 decl.c
--- decl.c	1999/02/21 16:38:14	1.312
+++ decl.c	1999/02/22 17:54:20
@@ -5029,6 +5029,8 @@ lookup_namespace_name (namespace, name)
       return error_mark_node;
     }
 
+  namespace = ORIGINAL_NAMESPACE (namespace);
+
   my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 373);
   
   val = binding_init (&_b);



More information about the Gcc-patches mailing list