diff options
author | Jason Merrill <jason@redhat.com> | 2000-10-23 17:38:33 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-10-23 17:38:33 -0400 |
commit | 6c6ed0ef928235a51966759aa3d6ca6cb960f334 (patch) | |
tree | 57169762c729b022aea2e99d12e99240487ac88e /gcc | |
parent | 57dd137ffb7556e2cbd6e3db18e495a8521e52fb (diff) | |
download | gcc-6c6ed0ef928235a51966759aa3d6ca6cb960f334.zip gcc-6c6ed0ef928235a51966759aa3d6ca6cb960f334.tar.gz gcc-6c6ed0ef928235a51966759aa3d6ca6cb960f334.tar.bz2 |
* call.c (equal_functions): Also call decls_match for extern "C" fns.
From-SVN: r37024
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/call.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/externC3.C | 15 |
3 files changed, 28 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 635105c..f7c2344 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2000-10-23 Jason Merrill <jason@redhat.com> + + * call.c (equal_functions): Also call decls_match for extern "C" fns. + +2000-10-22 Jason Merrill <jason@redhat.com> + + * call.c (build_conditional_expr): Use ocp_convert to force + rvalue conversion. + 2000-10-22 Mark Mitchell <mark@codesourcery.com> * call.c (standard_conversion): Use RVALUE_CONVs for all diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c31333e..ba77b64 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4931,14 +4931,16 @@ add_warning (winner, loser) } /* Returns true iff functions are equivalent. Equivalent functions are - not identical only if one is a function-local extern function. */ + not '==' only if one is a function-local extern function or if + both are extern "C". */ static inline int equal_functions (fn1, fn2) tree fn1; tree fn2; { - if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)) + if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2) + || DECL_EXTERN_C_FUNCTION_P (fn1)) return decls_match (fn1, fn2); return fn1 == fn2; } diff --git a/gcc/testsuite/g++.old-deja/g++.other/externC3.C b/gcc/testsuite/g++.old-deja/g++.other/externC3.C new file mode 100644 index 0000000..4869635 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/externC3.C @@ -0,0 +1,15 @@ +// Test that two extern "C" declarations of the same name in different +// namespaces are treated as declaring the same function. + +namespace foo { + extern "C" int f (); +} + +extern "C" int f () { return 0; } + +using namespace foo; + +int main () +{ + f (); +} |