From 7a4e50911138fcbba07816fa901efa00e57d13cc Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sat, 4 Nov 2000 18:47:16 +0000 Subject: [PATCH] decl2.c (do_nonmember_using_decl): Allow `extern "C"' declarations from different namespaces to be combined. * decl2.c (do_nonmember_using_decl): Allow `extern "C"' declarations from different namespaces to be combined. From-SVN: r37254 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl2.c | 10 ++++++---- gcc/testsuite/g++.old-deja/g++.ns/using14.C | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.ns/using14.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f180ac1db3e..a72b74c40a3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-11-04 Mark Mitchell + + * decl2.c (do_nonmember_using_decl): Allow `extern "C"' + declarations from different namespaces to be combined. + 2000-11-03 Zack Weinberg * decl.c: Include tm_p.h. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0cfcc4dee58..1af6d27b207 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -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 index 00000000000..522f8aea59a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using14.C @@ -0,0 +1,15 @@ +// Build don't link: +// Origin: Mark Mitchell + +extern "C" void f (); + +namespace N { +extern "C" void f (); +} + +using N::f; + +void g () +{ + f (); +} -- 2.30.2