OSDN Git Service

* init.c (build_aggr_init): Reject bogus array initializers
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Aug 2000 12:32:40 +0000 (12:32 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 10 Aug 2000 12:32:40 +0000 (12:32 +0000)
early.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35605 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/init.c

index 8912264..dc4e4c9 100644 (file)
@@ -1,3 +1,8 @@
+2000-08-10  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * init.c (build_aggr_init): Reject bogus array initializers
+       early.
+
 2000-08-09  Nathan Sidwell  <nathan@codesourcery.com>
 
        * rtti.c (build_dynamic_cast_1): Set "C" linkage for new abi
index d995e06..c35babb 100644 (file)
@@ -1186,13 +1186,8 @@ build_aggr_init (exp, init, flags)
       /* Must arrange to initialize each element of EXP
         from elements of INIT.  */
       tree itype = init ? TREE_TYPE (init) : NULL_TREE;
-      if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
-       {
-         TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
-         if (init)
-           TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
-       }
-      if (init && TREE_TYPE (init) == NULL_TREE)
+      
+      if (init && !itype)
        {
          /* Handle bad initializers like:
             class COMPLEX {
@@ -1206,9 +1201,15 @@ build_aggr_init (exp, init, flags)
               COMPLEX zees(1.0, 0.0)[10];
             }
          */
-         error ("bad array initializer");
+         cp_error ("bad array initializer");
          return error_mark_node;
        }
+      if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED)
+       {
+         TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
+         if (init)
+           TREE_TYPE (init) = TYPE_MAIN_VARIANT (itype);
+       }
       stmt_expr = build_vec_init (exp, exp, array_type_nelts (type), init,
                                  init && same_type_p (TREE_TYPE (init),
                                                       TREE_TYPE (exp)));