OSDN Git Service

PR c++/9798
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Mar 2003 22:04:09 +0000 (22:04 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Mar 2003 22:04:09 +0000 (22:04 +0000)
        * decl.c (push_using_directive): Push before recursing.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64133 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/lookup/using3.C [new file with mode: 0644]

index 4037471..9f70757 100644 (file)
@@ -1,6 +1,9 @@
 2003-03-10  Jason Merrill  <jason@redhat.com>
 
-       PR c++/9868
+       PR c++/9798
+       * decl.c (push_using_directive): Push before recursing.
+
+       PR c++/9868, c++/9524
        * call.c (resolve_scoped_fn_name): Handle the case of a function
        pointer member.
 
index b3e617f..eeae35a 100644 (file)
@@ -4442,14 +4442,15 @@ push_using_directive (tree used)
   if (purpose_member (used, ud) != NULL_TREE)
     POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
 
-  /* Recursively add all namespaces used.  */
-  for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
-    push_using_directive (TREE_PURPOSE (iter));
-
   ancestor = namespace_ancestor (current_decl_namespace (), used);
   ud = current_binding_level->using_directives;
   ud = tree_cons (used, ancestor, ud);
   current_binding_level->using_directives = ud;
+
+  /* Recursively add all namespaces used.  */
+  for (iter = DECL_NAMESPACE_USING (used); iter; iter = TREE_CHAIN (iter))
+    push_using_directive (TREE_PURPOSE (iter));
+
   POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ud);
 }
 
diff --git a/gcc/testsuite/g++.dg/lookup/using3.C b/gcc/testsuite/g++.dg/lookup/using3.C
new file mode 100644 (file)
index 0000000..f364275
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/9798
+
+namespace std { }
+namespace STL { using namespace std; }
+namespace std {
+  using namespace STL;
+}
+namespace STL {
+  struct A {
+    void B() { using namespace std; }
+  };
+}