decl2.c (do_nonmember_using_decl): Allow `extern "C"' declarations from different...
authorMark Mitchell <mark@codesourcery.com>
Sat, 4 Nov 2000 18:47:16 +0000 (18:47 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 4 Nov 2000 18:47:16 +0000 (18:47 +0000)
* decl2.c (do_nonmember_using_decl): Allow `extern "C"'
declarations from different namespaces to be combined.

From-SVN: r37254

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.old-deja/g++.ns/using14.C [new file with mode: 0644]

index f180ac1db3e8878a296fe6fb2b9db6b953859ef0..a72b74c40a35c1db3834ffa89ff030bb27e34f0d 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-04  Mark Mitchell  <mark@codesourcery.com>
+
+       * decl2.c (do_nonmember_using_decl): Allow `extern "C"'
+       declarations from different namespaces to be combined.
+
 2000-11-03  Zack Weinberg  <zack@wolery.stanford.edu>
 
        * decl.c: Include tm_p.h.
index 0cfcc4dee586b84cc8c9599817d402499ca751bd..1af6d27b207a58e3bc1470e90f8978c616ab0e98 100644 (file)
@@ -5204,10 +5204,12 @@ do_nonmember_using_decl (scope, name, oldval, oldtype, newval, newtype)
                  && compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
                                TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
                {
-                 /* There was already a non-using declaration in
-                    this scope with the same parameter types.  */
-                 cp_error ("`%D' is already declared in this scope",
-                           name);
+                 if (!(DECL_EXTERN_C_P (new_fn)
+                       && DECL_EXTERN_C_P (old_fn)))
+                   /* There was already a non-using declaration in
+                      this scope with the same parameter types.  */
+                   cp_error ("`%D' is already declared in this scope",
+                             name);
                  break;
                }
              else if (duplicate_decls (new_fn, old_fn))
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using14.C b/gcc/testsuite/g++.old-deja/g++.ns/using14.C
new file mode 100644 (file)
index 0000000..522f8ae
--- /dev/null
@@ -0,0 +1,15 @@
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+extern "C" void f ();
+
+namespace N {
+extern "C" void f ();
+}
+
+using N::f;
+
+void g ()
+{
+  f ();
+}