From 7e2067caa69aad3e63ccdc9f2d12f003c7842f0a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 29 Nov 1998 18:27:12 +0000 Subject: [PATCH] typeck2.c (process_init_constructor): Use same_type_p. * typeck2.c (process_init_constructor): Use same_type_p. Fixes 834Y21a * decl.c (check_tag_decl): Don't warn about null decl inside a class. Fixes _113Y11a From-SVN: r23982 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl.c | 16 ++++++---------- gcc/cp/typeck2.c | 7 ++++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2ec4103d885..3cfe7012719 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 1998-11-29 Jason Merrill + * typeck2.c (process_init_constructor): Use same_type_p. + + * decl.c (check_tag_decl): Don't warn about null decl inside a + class. + * pt.c (unify, case OFFSET_TYPE): Pass down 'strict' rather than UNIFY_ALLOW_NONE. (convert_nontype_argument): Use TYPE_PTRMEMFUNC_FN_TYPE. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2f48d3b2df2..cbb284e9f2b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6462,7 +6462,6 @@ check_tag_decl (declspecs) tree declspecs; { int found_type = 0; - int friendp = 0; tree ob_modifier = NULL_TREE; register tree link; register tree t = NULL_TREE; @@ -6486,8 +6485,6 @@ check_tag_decl (declspecs) if (current_class_type == NULL_TREE || current_scope () != current_class_type) ob_modifier = value; - else - friendp = 1; } else if (value == ridpointers[(int) RID_STATIC] || value == ridpointers[(int) RID_EXTERN] @@ -6503,13 +6500,12 @@ check_tag_decl (declspecs) if (found_type > 1) error ("multiple types in one declaration"); - - if (t == NULL_TREE) - { - if (! friendp) - pedwarn ("declaration does not declare anything"); - } - else if (ANON_UNION_TYPE_P (t)) + + /* Inside a class, we might be in a friend or access declaration. + Until we have a good way of detecting the latter, don't warn. */ + if (t == NULL_TREE && ! current_class_type) + pedwarn ("declaration does not declare anything"); + else if (t && ANON_UNION_TYPE_P (t)) /* Anonymous unions are objects, so they can have specifiers. */; else if (ob_modifier) { diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b638f40ee19..08a3dc232eb 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -925,9 +925,10 @@ process_init_constructor (type, init, elts) tree tail1 = tail; next1 = digest_init (TREE_TYPE (type), TREE_VALUE (tail), &tail1); - my_friendly_assert (TYPE_MAIN_VARIANT (TREE_TYPE (type)) - == TYPE_MAIN_VARIANT (TREE_TYPE (next1)), - 981123); + my_friendly_assert + (same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (type)), + TYPE_MAIN_VARIANT (TREE_TYPE (next1))), + 981123); my_friendly_assert (tail1 == 0 || TREE_CODE (tail1) == TREE_LIST, 319); if (tail == tail1 && len < 0) -- 2.30.2