summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-03 15:01:16 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-03 15:01:16 +0000
commitc8a3d5fedfd03ffc445e15699a5652f1c464ab8d (patch)
tree05e846ad2f99f1b94283c33660259c916def2d36 /gcc
parent970c0c06160ffd4f71dab39c1fda2acbc1374281 (diff)
downloadgcc-c8a3d5fedfd03ffc445e15699a5652f1c464ab8d.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38661 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/search.c34
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/virtual11.C31
4 files changed, 45 insertions, 30 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bee60d6bbc1..492a4dc4619 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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.
* cp-tree.h (merge_exceptions_specifiers): Declare new function.
* method.c (synthesize_exception_spec): New function.
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index e2fab522fa9..5beedb0a607 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -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))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c45ae5cbef8..32b834958af 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
2001-01-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual11.C b/gcc/testsuite/g++.old-deja/g++.other/virtual11.C
new file mode 100644
index 00000000000..62c9b24613f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/virtual11.C
@@ -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
+};