From: Alexandre Oliva Date: Wed, 2 Mar 2005 19:57:10 +0000 (+0000) Subject: name-lookup.c (push_overloaded_decl): Don't error if the new decl matches the old... X-Git-Tag: releases/gcc-3.4.4~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad8d8a76aebf31df41e6406db070fdb150248b9e;p=thirdparty%2Fgcc.git name-lookup.c (push_overloaded_decl): Don't error if the new decl matches the old one. gcc/cp/ChangeLog: * name-lookup.c (push_overloaded_decl): Don't error if the new decl matches the old one. * decl.c (redeclaration_error_message): Likewise. gcc/testsuite/ChangeLog: * g++.dg/overload/using2.C: New. From-SVN: r95800 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 003cff3cf844..9eeebd992265 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-03-02 Alexandre Oliva + + * name-lookup.c (push_overloaded_decl): Don't error if the new + decl matches the old one. + * decl.c (redeclaration_error_message): Likewise. + 2005-02-24 Jakub Jelinek PR c++/20175 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 397b60d56441..84c25d467e09 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1,6 +1,6 @@ /* Process declarations and variables for C++ compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -2023,7 +2023,8 @@ redeclaration_error_message (tree newdecl, tree olddecl) /* If both functions come from different namespaces, this is not a redeclaration - this is a conflict with a used function. */ if (DECL_NAMESPACE_SCOPE_P (olddecl) - && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl)) + && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl) + && ! decls_match (olddecl, newdecl)) return "`%D' conflicts with used function"; /* We'll complain about linkage mismatches in diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 80f4c2946c25..3e79d3e568eb 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1,5 +1,5 @@ /* Definitions for C++ name lookup routines. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis This file is part of GCC. @@ -2018,7 +2018,8 @@ push_overloaded_decl (tree decl, int flags) if (TREE_CODE (tmp) == OVERLOAD && OVL_USED (tmp) && !(flags & PUSH_USING) && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)), - TYPE_ARG_TYPES (TREE_TYPE (decl)))) + TYPE_ARG_TYPES (TREE_TYPE (decl))) + && ! decls_match (fn, decl)) error ("`%#D' conflicts with previous using declaration `%#D'", decl, fn); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86bf512dcda6..dca1f18ba350 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-03-02 Alexandre Oliva + + * g++.dg/overload/using2.C: New. + 2005-02-24 Jakub Jelinek PR c++/20175