* pt.c (tsubst): Allow an array of explicit size zero.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 24 Feb 1999 11:46:56 +0000 (11:46 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 24 Feb 1999 11:46:56 +0000 (06:46 -0500)
From-SVN: r25400

gcc/cp/ChangeLog
gcc/cp/pt.c

index 8aacd3f8a49d95f1541f99df0a40848319f19451..348739f079c0e39c05f7b7744e7625faa760e745 100644 (file)
@@ -1,3 +1,7 @@
+1999-02-24  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (tsubst): Allow an array of explicit size zero.
+
 1999-02-23  Jason Merrill  <jason@yorick.cygnus.com>
 
        * errfn.c: Change varargs code to look like toplev.c.
index 905bdf6fe143ff47229fd503a83eb58b5b3e731c..b13a8c832ebf65e01969164aa9d79230f43c513d 100644 (file)
@@ -6017,9 +6017,9 @@ tsubst (t, args, complain, in_decl)
        return t;
 
       {
-       tree max = TREE_OPERAND (TYPE_MAX_VALUE (t), 0);
+       tree max, omax = TREE_OPERAND (TYPE_MAX_VALUE (t), 0);
 
-       max = tsubst_expr (max, args, complain, in_decl);
+       max = tsubst_expr (omax, args, complain, in_decl);
        if (max == error_mark_node)
          return error_mark_node;
 
@@ -6032,7 +6032,13 @@ tsubst (t, args, complain, in_decl)
            return itype;
          }
 
-       if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node))
+       if (integer_zerop (omax))
+         {
+           /* Still allow an explicit array of size zero.  */
+           if (pedantic)
+             pedwarn ("creating array with size zero");
+         }
+       else if (integer_zerop (max) || INT_CST_LT (max, integer_zero_node))
          {
            /* [temp.deduct]