From 1d6ec3528e51acedf66318fe144c78df45b348ef Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 7 Sep 1999 07:52:06 +0000 Subject: [PATCH] pt.c (tsubst): Back out 1999-08-06 patch. * 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 | 5 +++++ gcc/cp/pt.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5c44b60af358..2d9bb19bcf78 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1999-09-06 Mark Mitchell + + * pt.c (tsubst): Back out 1999-08-06 patch. Use fold and + decl_constant_value to simplify array bounds. + 1999-08-19 Jason Merrill * cp-tree.h: Declare flag_use_repository. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 69dfa97e61ad..ddbea0ac9866 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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)) -- 2.47.2