From c95cd22e91f49e87c7eab9506aa6d8769a2207d1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 16 Nov 1999 05:58:53 +0000 Subject: [PATCH] cp-tree.h, decl.c (compute_array_index_type): Make nonstatic. * cp-tree.h, decl.c (compute_array_index_type): Make nonstatic. * pt.c (tsubst, case INTEGER_TYPE): Call it. Check uses_template_parms. From-SVN: r30548 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/cp-tree.h | 3 ++- gcc/cp/decl.c | 15 ++++++++------- gcc/cp/pt.c | 10 ++++++---- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cc45c1e..9bdfe91 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 1999-11-15 Jason Merrill + * cp-tree.h, decl.c (compute_array_index_type): Make nonstatic. + * pt.c (tsubst, case INTEGER_TYPE): Call it. + Check uses_template_parms. + * class.c (finish_struct): If we're a local class in a template function, add a TAG_DEFN. * pt.c (lookup_template_class): If this is a local class in a diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 47a88b7..dfa934e 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3497,8 +3497,9 @@ extern int in_function_p PROTO((void)); extern void replace_defarg PROTO((tree, tree)); extern void print_other_binding_stack PROTO((struct binding_level *)); extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); -extern void fixup_anonymous_aggr PROTO((tree)); +extern void fixup_anonymous_aggr PROTO((tree)); extern int check_static_variable_definition PROTO((tree, tree)); +extern tree compute_array_index_type PROTO((tree, tree)); extern void push_local_binding PROTO((tree, tree, int)); extern int push_class_binding PROTO((tree, tree)); extern tree check_default_argument PROTO((tree, tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 11073f9..38451dd 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -175,7 +175,6 @@ static void destroy_local_static PROTO((tree)); static void destroy_local_var PROTO((tree)); static void finish_constructor_body PROTO((void)); static void finish_destructor_body PROTO((void)); -static tree compute_array_index_type PROTO((tree, tree)); static tree create_array_type_for_decl PROTO((tree, tree, tree)); #if defined (DEBUG_CP_BINDING_LEVELS) @@ -7033,7 +7032,9 @@ layout_var_decl (decl) tree decl; { tree type = TREE_TYPE (decl); +#if 0 tree ttype = target_type (type); +#endif /* If we haven't already layed out this declaration, do so now. Note that we must not call complete type for an external object @@ -8679,7 +8680,7 @@ check_static_variable_definition (decl, type) appropriate index type for the array. If non-NULL, NAME is the name of the thing being declared. */ -static tree +tree compute_array_index_type (name, size) tree name; tree size; @@ -13469,15 +13470,15 @@ finish_function (lineno, flags) } else { +#if 0 if (write_symbols != NO_DEBUG /*&& TREE_CODE (fntype) != METHOD_TYPE*/) { - tree ttype = target_type (fntype); - tree parmdecl; - -#if 0 /* Keep this code around in case we later want to control debug info based on whether a type is "used". (jason 1999-11-11) */ + tree ttype = target_type (fntype); + tree parmdecl; + if (IS_AGGR_TYPE (ttype)) /* Let debugger know it should output info for this type. */ note_debug_info_needed (ttype); @@ -13489,8 +13490,8 @@ finish_function (lineno, flags) /* Let debugger know it should output info for this type. */ note_debug_info_needed (ttype); } -#endif } +#endif /* Clean house because we will need to reorder insns here. */ do_pending_stack_adjust (); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7e72acc..7e3a8ab 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6179,8 +6179,11 @@ tsubst (t, args, complain, in_decl) /* When providing explicit arguments to a template function, but leaving some arguments for subsequent deduction, MAX may be template-dependent even if we're - not PROCESSING_TEMPLATE_DECL. */ - || TREE_CODE (max) != INTEGER_CST) + not PROCESSING_TEMPLATE_DECL. We still need to check for + template parms, though; MAX won't be an INTEGER_CST for + dynamic arrays, either. */ + || (TREE_CODE (max) != INTEGER_CST + && uses_template_parms (max))) { tree itype = make_node (INTEGER_TYPE); TYPE_MIN_VALUE (itype) = size_zero_node; @@ -6210,8 +6213,7 @@ tsubst (t, args, complain, in_decl) return error_mark_node; } - max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node)); - return build_index_type (max); + return compute_array_index_type (NULL_TREE, max); } case TEMPLATE_TYPE_PARM: -- 2.7.4