re PR c++/9336 (ICE in cp_line_of, at cp/error.c:2191)
authorMark Mitchell <mark@codesourcery.com>
Wed, 12 Mar 2003 07:23:15 +0000 (07:23 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Wed, 12 Mar 2003 07:23:15 +0000 (07:23 +0000)
PR c++/9336
* g++.dg/parse/namespace8.C: New test.

PR c++/9336
* decl2.c (do_nonmember_using_decl): Do not call duplicate decls
to merge old and new declarations.

From-SVN: r64216

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/namespace8.C [new file with mode: 0644]

index a8788f270b39a240f17430b333171b81084d5d6d..a45fc53e610fe4f8eb3ac3276eddbf5fc5db527d 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-11  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/9336
+       * decl2.c (do_nonmember_using_decl): Do not call duplicate decls
+       to merge old and new declarations.
+
 2003-03-12  Alexandre Oliva  <aoliva@redhat.com>
 
        * g++.1: Remove.
@@ -8,6 +14,10 @@
 
 2003-03-11  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9336
+       * decl2.c (do_nonmember_using_decl): Do not call duplicate decls
+       to merge old and new declarations.
+
        PR c++/9924
        * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins.
 
index b96f65f2034e9fa451fdd4197484ebed01d63e81..b4654c9036f35a68b6ef21debf432c5776519c84 100644 (file)
@@ -4222,12 +4222,6 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
     {
       tree tmp, tmp1;
 
-      if (oldval && !is_overloaded_fn (oldval))
-       {
-         duplicate_decls (OVL_CURRENT (BINDING_VALUE (decls)), oldval);
-         oldval = NULL_TREE;
-       }
-
       *newval = oldval;
       for (tmp = BINDING_VALUE (decls); tmp; tmp = OVL_NEXT (tmp))
        {
@@ -4290,12 +4284,12 @@ do_nonmember_using_decl (tree scope, tree name, tree oldval, tree oldtype,
   else 
     {
       *newval = BINDING_VALUE (decls);
-      if (oldval)
-       duplicate_decls (*newval, oldval);
-    } 
+      if (oldval && !decls_match (*newval, oldval))
+       error ("`%D' is already declared in this scope", name);
+    }
 
   *newtype = BINDING_TYPE (decls);
-  if (oldtype && *newtype && oldtype != *newtype)
+  if (oldtype && *newtype && !same_type_p (oldtype, *newtype))
     {
       error ("using declaration `%D' introduced ambiguous type `%T'",
                name, oldtype);
index 8cd81afe61f0181baf3e4609ac5c2c4babbc84da..637bdac75f9a1b9c5f1a2debebcbebf46f39f122 100644 (file)
@@ -1,5 +1,8 @@
 2003-03-11  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/9336
+       * g++.dg/parse/namespace8.C: New test.
+
        PR c++/9924
        * g++.dg/overload/builtin2.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/parse/namespace8.C b/gcc/testsuite/g++.dg/parse/namespace8.C
new file mode 100644 (file)
index 0000000..d5a9b0a
--- /dev/null
@@ -0,0 +1,6 @@
+namespace X {
+  typedef struct {
+  } x;
+}
+typedef X::x x;
+using X::x;