aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-11-29 18:27:12 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-11-29 13:27:12 -0500
commit7e2067caa69aad3e63ccdc9f2d12f003c7842f0a (patch)
treef015879b232347722f4326dc76ac52112d881048 /gcc
parent9f3d9e461cb4c63c2b260ae6509799db75346db8 (diff)
downloadgcc-7e2067caa69aad3e63ccdc9f2d12f003c7842f0a.zip
gcc-7e2067caa69aad3e63ccdc9f2d12f003c7842f0a.tar.gz
gcc-7e2067caa69aad3e63ccdc9f2d12f003c7842f0a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c16
-rw-r--r--gcc/cp/typeck2.c7
3 files changed, 15 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2ec4103..3cfe701 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
1998-11-29 Jason Merrill <jason@yorick.cygnus.com>
+ * 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 2f48d3b..cbb284e 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 b638f40..08a3dc2 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)