search.c (lookup_fnfields_here): Remove.
cp: * search.c (lookup_fnfields_here): Remove. (look_for_overrides_r): Use lookup_fnfields_1. Ignore functions from using declarations. testsuite: * g++.old-deja/g++.other/virtual11.C: New test. From-SVN: r38661
This commit is contained in:
parent
713f41f9b3
commit
3c505507d3
@ -1,3 +1,9 @@
|
||||
2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* search.c (lookup_fnfields_here): Remove.
|
||||
(look_for_overrides_r): Use lookup_fnfields_1.
|
||||
Ignore functions from using declarations.
|
||||
|
||||
2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
Implement exceptions specifiers for implicit member functions.
|
||||
|
@ -85,7 +85,6 @@ struct vbase_info
|
||||
|
||||
static tree get_vbase_1 PARAMS ((tree, tree, unsigned int *));
|
||||
static tree lookup_field_1 PARAMS ((tree, tree));
|
||||
static int lookup_fnfields_here PARAMS ((tree, tree));
|
||||
static int is_subobject_of_p PARAMS ((tree, tree, tree));
|
||||
static tree virtual_context PARAMS ((tree, tree, tree));
|
||||
static tree dfs_check_overlap PARAMS ((tree, void *));
|
||||
@ -1249,33 +1248,6 @@ is_subobject_of_p (parent, binfo, most_derived)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Very similar to lookup_fnfields_1 but it ensures that at least one
|
||||
function was declared inside the class given by TYPE. It really should
|
||||
only return functions that match the given TYPE. Therefore, it should
|
||||
only be called for situations that ignore using-declarations, such as
|
||||
determining overrides. */
|
||||
|
||||
static int
|
||||
lookup_fnfields_here (type, name)
|
||||
tree type, name;
|
||||
{
|
||||
int idx = lookup_fnfields_1 (type, name);
|
||||
tree fndecls;
|
||||
|
||||
/* ctors and dtors are always only in the right class. */
|
||||
if (idx <= 1)
|
||||
return idx;
|
||||
fndecls = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
|
||||
while (fndecls)
|
||||
{
|
||||
if (TYPE_MAIN_VARIANT (DECL_CONTEXT (OVL_CURRENT (fndecls)))
|
||||
== TYPE_MAIN_VARIANT (type))
|
||||
return idx;
|
||||
fndecls = OVL_CHAIN (fndecls);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct lookup_field_info {
|
||||
/* The type in which we're looking. */
|
||||
tree type;
|
||||
@ -2015,7 +1987,7 @@ look_for_overrides_r (type, fndecl)
|
||||
if (DECL_DESTRUCTOR_P (fndecl))
|
||||
ix = CLASSTYPE_DESTRUCTOR_SLOT;
|
||||
else
|
||||
ix = lookup_fnfields_here (type, DECL_NAME (fndecl));
|
||||
ix = lookup_fnfields_1 (type, DECL_NAME (fndecl));
|
||||
if (ix >= 0)
|
||||
{
|
||||
tree fns = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), ix);
|
||||
@ -2029,7 +2001,9 @@ look_for_overrides_r (type, fndecl)
|
||||
tree btypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
|
||||
|
||||
if (!DECL_VIRTUAL_P (fn))
|
||||
;
|
||||
/* Not a virtual */;
|
||||
else if (DECL_CONTEXT (fn) != type)
|
||||
/* Introduced with a using declaration */;
|
||||
else if (thistype == NULL_TREE)
|
||||
{
|
||||
if (compparms (TREE_CHAIN (btypes), dtypes))
|
||||
|
@ -1,3 +1,7 @@
|
||||
2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.other/virtual11.C: New test.
|
||||
|
||||
2001-01-03 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.old-deja/g++.eh/spec6.C: Remove remaining XFAIL.
|
||||
|
31
gcc/testsuite/g++.old-deja/g++.other/virtual11.C
Normal file
31
gcc/testsuite/g++.old-deja/g++.other/virtual11.C
Normal file
@ -0,0 +1,31 @@
|
||||
// Build don't link:
|
||||
|
||||
// Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
|
||||
|
||||
// We failed to check virtual functions hidden by using declarations.
|
||||
|
||||
struct A
|
||||
{
|
||||
virtual int foo ();
|
||||
};
|
||||
|
||||
struct B
|
||||
{
|
||||
virtual void foo (); // ERROR - of this function
|
||||
};
|
||||
|
||||
struct C : A , B
|
||||
{
|
||||
};
|
||||
|
||||
struct D : C
|
||||
{
|
||||
void foo (short);
|
||||
using A::foo;
|
||||
};
|
||||
|
||||
struct E : D
|
||||
{
|
||||
virtual int foo (); // ERROR - invalid override
|
||||
};
|
Loading…
Reference in New Issue
Block a user