diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-09 08:16:49 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-09 08:16:49 +0000 |
commit | 28bbd27a09dc1c4cc88f24ac1088c9e8472d0f5b (patch) | |
tree | 4053bda91421405c7881ecbb817f38fb71ebe500 /gcc/cp/search.c | |
parent | 7c9e3513b011c9127ccbea3cd77ac44b3dd8b057 (diff) | |
download | gcc-28bbd27a09dc1c4cc88f24ac1088c9e8472d0f5b.tar.gz |
PR c++/14401
* class.c (check_field_decls): Complain about non-static data
members of reference type in unions. Propagate
CLASSTYPE_REF_FIELDS_NEED_INIT and
CLASSTYPE_READONLY_FIELDS_NEED_INIT from the types of non-static
data members.
* init.c (perform_member_init): Complain about mbmers with const
type that are not explicitly initialized.
PR c++/14401
* g++.dg/init/ctor3.C: New test.
* g++.dg/init/union1.C: New test.
* g++.dg/ext/anon-struct4.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79158 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/search.c')
-rw-r--r-- | gcc/cp/search.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 1b8c8c8afe4..5b66000c34e 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -1703,7 +1703,10 @@ check_final_overrider (tree overrider, tree basefn) tree over_throw = TYPE_RAISES_EXCEPTIONS (over_type); tree base_throw = TYPE_RAISES_EXCEPTIONS (base_type); int fail = 0; - + + if (DECL_INVALID_OVERRIDER_P (overrider)) + return 0; + if (same_type_p (base_return, over_return)) /* OK */; else if ((CLASS_TYPE_P (over_return) && CLASS_TYPE_P (base_return)) @@ -1753,8 +1756,6 @@ check_final_overrider (tree overrider, tree basefn) fail = 2; if (!fail) /* OK */; - else if (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider))) - return 0; else { if (fail == 1) @@ -1768,21 +1769,16 @@ check_final_overrider (tree overrider, tree basefn) overrider); cp_error_at (" overriding `%#D'", basefn); } - SET_IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider), - DECL_CONTEXT (overrider)); + DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; } /* Check throw specifier is at least as strict. */ if (!comp_except_specs (base_throw, over_throw, 0)) { - if (!IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider))) - { - cp_error_at ("looser throw specifier for `%#F'", overrider); - cp_error_at (" overriding `%#F'", basefn); - SET_IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (overrider), - DECL_CONTEXT (overrider)); - } + cp_error_at ("looser throw specifier for `%#F'", overrider); + cp_error_at (" overriding `%#F'", basefn); + DECL_INVALID_OVERRIDER_P (overrider) = 1; return 0; } |