]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pt.c (tsubst): Back out 1999-08-06 patch.
authorMark Mitchell <mark@codesourcery.com>
Tue, 7 Sep 1999 07:52:06 +0000 (07:52 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 7 Sep 1999 07:52:06 +0000 (01:52 -0600)
        * pt.c (tsubst): Back out 1999-08-06 patch.  Use fold and
        decl_constant_value to simplify array bounds.

From-SVN: r29159

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

index 5c44b60af358ab59b9ac5156d5ad3e74088a0308..2d9bb19bcf78accb022809ae06a246a7c5955f4e 100644 (file)
@@ -1,3 +1,8 @@
+1999-09-06  Mark Mitchell  <mark@codesourcery.com>
+
+       * pt.c (tsubst): Back out 1999-08-06 patch.  Use fold and
+       decl_constant_value to simplify array bounds.
+
 1999-08-19  Jason Merrill  <jason@yorick.cygnus.com>
 
        * cp-tree.h: Declare flag_use_repository.
index 69dfa97e61adaf4b5cf9fcb08ea76c5882d5e0d9..ddbea0ac98661e55167bcd2eb9e766352930465b 100644 (file)
@@ -6130,6 +6130,11 @@ tsubst (t, args, complain, in_decl)
        if (max == error_mark_node)
          return error_mark_node;
 
+       /* See if we can reduce this expression to something simpler.  */
+       max = maybe_fold_nontype_arg (max);
+       if (!processing_template_decl && TREE_READONLY_DECL_P (max))
+         max = decl_constant_value (max);
+
        if (processing_template_decl 
            /* When providing explicit arguments to a template
               function, but leaving some arguments for subsequent
@@ -6137,8 +6142,11 @@ tsubst (t, args, complain, in_decl)
               not PROCESSING_TEMPLATE_DECL.  */
            || TREE_CODE (max) != INTEGER_CST)
          {
-           return build_index_type (build_min
-             (MINUS_EXPR, sizetype, max, integer_one_node));
+           tree itype = make_node (INTEGER_TYPE);
+           TYPE_MIN_VALUE (itype) = size_zero_node;
+           TYPE_MAX_VALUE (itype) = build_min (MINUS_EXPR, sizetype, max,
+                                               integer_one_node);
+           return itype;
          }
 
        if (integer_zerop (omax))