diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-10-18 12:30:32 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2005-10-18 12:30:32 +0000 |
commit | b77fe7b45f5a162d5d0f3cc64044281220076c04 (patch) | |
tree | 8c6ffe176818c794b78be35002d3b48a05a4cf5d /gcc/cp/semantics.c | |
parent | 6d7e9a3582b6ce807b1d380c757cf50e5f41ec65 (diff) | |
download | gcc-b77fe7b45f5a162d5d0f3cc64044281220076c04.zip gcc-b77fe7b45f5a162d5d0f3cc64044281220076c04.tar.gz gcc-b77fe7b45f5a162d5d0f3cc64044281220076c04.tar.bz2 |
re PR c++/22604 (ICE after invalid covariant return)
cp:
PR c++/22604
* class.c (update_vtable_entry_for_fn): Don't process invalid
covariant overriders.
PR c++/23118
* cp-tree.h (add_method): Add return value.
* class.c (add_method): Return success indicator.
* semantics.c (finish_member_declaration): Don't add an invalid
method to the method list.
testsuite:
PR c++/23118
* g++.dg/overload/error2.C: New.
PR c++/22604
* g++.dg/inherit/covariant14.C: New.
From-SVN: r105549
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 5ccc7c7..95387e1 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2232,13 +2232,14 @@ finish_member_declaration (tree decl) { /* We also need to add this function to the CLASSTYPE_METHOD_VEC. */ - add_method (current_class_type, decl, NULL_TREE); - - TREE_CHAIN (decl) = TYPE_METHODS (current_class_type); - TYPE_METHODS (current_class_type) = decl; + if (add_method (current_class_type, decl, NULL_TREE)) + { + TREE_CHAIN (decl) = TYPE_METHODS (current_class_type); + TYPE_METHODS (current_class_type) = decl; - maybe_add_class_template_decl_list (current_class_type, decl, - /*friend_p=*/0); + maybe_add_class_template_decl_list (current_class_type, decl, + /*friend_p=*/0); + } } /* Enter the DECL into the scope of the class. */ else if ((TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl)) |