]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
typeck2.c (process_init_constructor): Use same_type_p.
authorJason Merrill <jason@yorick.cygnus.com>
Sun, 29 Nov 1998 18:27:12 +0000 (18:27 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 29 Nov 1998 18:27:12 +0000 (13:27 -0500)
* 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
gcc/cp/decl.c
gcc/cp/typeck2.c

index 2ec4103d885129783fb98b80c30cd596ad6a5dd8..3cfe70127199859ba3a5a592b4468a42c11f84e5 100644 (file)
@@ -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.
index 2f48d3b2df2eeaecdcac602c92743e4153f482d8..cbb284e9f2bd234e5c9622bd5d810191c3405ee5 100644 (file)
@@ -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)
     {
index b638f40ee19238027a67e85fcba88dcc9af5878f..08a3dc232ebb1aab9baf158533e599cde6501c89 100644 (file)
@@ -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)