mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-07 17:30:16 +08:00
decl2.c (add_function): Reorganize.
* decl2.c (add_function): Reorganize. (arg_assoc): Do not consider function template decls. From-SVN: r35653
This commit is contained in:
parent
3388651ce0
commit
9845b52bfb
@ -1,3 +1,8 @@
|
|||||||
|
2000-08-11 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
|
||||||
|
|
||||||
|
* decl2.c (add_function): Reorganize.
|
||||||
|
(arg_assoc): Do not consider function template decls.
|
||||||
|
|
||||||
2000-08-11 Jason Merrill <jason@redhat.com>
|
2000-08-11 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
* decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
|
* decl.c (lookup_name_real): Don't forget the TYPENAME_TYPE we're
|
||||||
|
@ -4791,10 +4791,11 @@ add_function (k, fn)
|
|||||||
case. */
|
case. */
|
||||||
|
|
||||||
/* We must find only functions, or exactly one non-function. */
|
/* We must find only functions, or exactly one non-function. */
|
||||||
if (k->functions && is_overloaded_fn (k->functions)
|
if (!k->functions)
|
||||||
&& is_overloaded_fn (fn))
|
k->functions = fn;
|
||||||
|
else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
|
||||||
k->functions = build_overload (fn, k->functions);
|
k->functions = build_overload (fn, k->functions);
|
||||||
else if (k->functions)
|
else
|
||||||
{
|
{
|
||||||
tree f1 = OVL_CURRENT (k->functions);
|
tree f1 = OVL_CURRENT (k->functions);
|
||||||
tree f2 = fn;
|
tree f2 = fn;
|
||||||
@ -4807,8 +4808,7 @@ add_function (k, fn)
|
|||||||
cp_error (" in call to `%D'", k->name);
|
cp_error (" in call to `%D'", k->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
k->functions = fn;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5063,9 +5063,15 @@ arg_assoc (k, n)
|
|||||||
{
|
{
|
||||||
my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
|
my_friendly_assert (TREE_CODE (n) == OVERLOAD, 980715);
|
||||||
|
|
||||||
for (; n; n = OVL_CHAIN (n))
|
for (; n; n = OVL_CHAIN (n))
|
||||||
if (arg_assoc_type (k, TREE_TYPE (OVL_FUNCTION (n))))
|
{
|
||||||
return 1;
|
/* Do not consider function template decls during Koenig lookup. */
|
||||||
|
|
||||||
|
tree fn = OVL_FUNCTION (n);
|
||||||
|
if (!DECL_FUNCTION_TEMPLATE_P (fn)
|
||||||
|
&& arg_assoc_type (k, TREE_TYPE (fn)))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
13
gcc/testsuite/g++.old-deja/g++.ns/koenig9.C
Normal file
13
gcc/testsuite/g++.old-deja/g++.ns/koenig9.C
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Build don't link:
|
||||||
|
|
||||||
|
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
// Contributed by Theodore.Papadopoulo 23 Jun 2000 <Theodore.Papadopoulo@sophia.inria.fr>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
void foo(const char*,...);
|
||||||
|
|
||||||
|
inline void
|
||||||
|
bar() {
|
||||||
|
foo("",count); // ERROR - multiple overloaded count functions
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user