Commit c95cd22e by Jason Merrill Committed by Jason Merrill

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
parent 63408827
1999-11-15 Jason Merrill <jason@casey.cygnus.com> 1999-11-15 Jason Merrill <jason@casey.cygnus.com>
* 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 * class.c (finish_struct): If we're a local class in a template
function, add a TAG_DEFN. function, add a TAG_DEFN.
* pt.c (lookup_template_class): If this is a local class in a * pt.c (lookup_template_class): If this is a local class in a
......
...@@ -3497,8 +3497,9 @@ extern int in_function_p PROTO((void)); ...@@ -3497,8 +3497,9 @@ extern int in_function_p PROTO((void));
extern void replace_defarg PROTO((tree, tree)); extern void replace_defarg PROTO((tree, tree));
extern void print_other_binding_stack PROTO((struct binding_level *)); extern void print_other_binding_stack PROTO((struct binding_level *));
extern void revert_static_member_fn PROTO((tree*, tree*, tree*)); 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 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 void push_local_binding PROTO((tree, tree, int));
extern int push_class_binding PROTO((tree, tree)); extern int push_class_binding PROTO((tree, tree));
extern tree check_default_argument PROTO((tree, tree)); extern tree check_default_argument PROTO((tree, tree));
......
...@@ -175,7 +175,6 @@ static void destroy_local_static PROTO((tree)); ...@@ -175,7 +175,6 @@ static void destroy_local_static PROTO((tree));
static void destroy_local_var PROTO((tree)); static void destroy_local_var PROTO((tree));
static void finish_constructor_body PROTO((void)); static void finish_constructor_body PROTO((void));
static void finish_destructor_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)); static tree create_array_type_for_decl PROTO((tree, tree, tree));
#if defined (DEBUG_CP_BINDING_LEVELS) #if defined (DEBUG_CP_BINDING_LEVELS)
...@@ -7033,7 +7032,9 @@ layout_var_decl (decl) ...@@ -7033,7 +7032,9 @@ layout_var_decl (decl)
tree decl; tree decl;
{ {
tree type = TREE_TYPE (decl); tree type = TREE_TYPE (decl);
#if 0
tree ttype = target_type (type); tree ttype = target_type (type);
#endif
/* If we haven't already layed out this declaration, do so now. /* If we haven't already layed out this declaration, do so now.
Note that we must not call complete type for an external object Note that we must not call complete type for an external object
...@@ -8679,7 +8680,7 @@ check_static_variable_definition (decl, type) ...@@ -8679,7 +8680,7 @@ check_static_variable_definition (decl, type)
appropriate index type for the array. If non-NULL, NAME is the appropriate index type for the array. If non-NULL, NAME is the
name of the thing being declared. */ name of the thing being declared. */
static tree tree
compute_array_index_type (name, size) compute_array_index_type (name, size)
tree name; tree name;
tree size; tree size;
...@@ -13469,15 +13470,15 @@ finish_function (lineno, flags) ...@@ -13469,15 +13470,15 @@ finish_function (lineno, flags)
} }
else else
{ {
#if 0
if (write_symbols != NO_DEBUG /*&& TREE_CODE (fntype) != METHOD_TYPE*/) 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 /* Keep this code around in case we later want to control debug info
based on whether a type is "used". (jason 1999-11-11) */ based on whether a type is "used". (jason 1999-11-11) */
tree ttype = target_type (fntype);
tree parmdecl;
if (IS_AGGR_TYPE (ttype)) if (IS_AGGR_TYPE (ttype))
/* Let debugger know it should output info for this type. */ /* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype); note_debug_info_needed (ttype);
...@@ -13489,8 +13490,8 @@ finish_function (lineno, flags) ...@@ -13489,8 +13490,8 @@ finish_function (lineno, flags)
/* Let debugger know it should output info for this type. */ /* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype); note_debug_info_needed (ttype);
} }
#endif
} }
#endif
/* Clean house because we will need to reorder insns here. */ /* Clean house because we will need to reorder insns here. */
do_pending_stack_adjust (); do_pending_stack_adjust ();
......
...@@ -6179,8 +6179,11 @@ tsubst (t, args, complain, in_decl) ...@@ -6179,8 +6179,11 @@ tsubst (t, args, complain, in_decl)
/* When providing explicit arguments to a template /* When providing explicit arguments to a template
function, but leaving some arguments for subsequent function, but leaving some arguments for subsequent
deduction, MAX may be template-dependent even if we're deduction, MAX may be template-dependent even if we're
not PROCESSING_TEMPLATE_DECL. */ not PROCESSING_TEMPLATE_DECL. We still need to check for
|| TREE_CODE (max) != INTEGER_CST) 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); tree itype = make_node (INTEGER_TYPE);
TYPE_MIN_VALUE (itype) = size_zero_node; TYPE_MIN_VALUE (itype) = size_zero_node;
...@@ -6210,8 +6213,7 @@ tsubst (t, args, complain, in_decl) ...@@ -6210,8 +6213,7 @@ tsubst (t, args, complain, in_decl)
return error_mark_node; return error_mark_node;
} }
max = fold (build_binary_op (MINUS_EXPR, max, integer_one_node)); return compute_array_index_type (NULL_TREE, max);
return build_index_type (max);
} }
case TEMPLATE_TYPE_PARM: case TEMPLATE_TYPE_PARM:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment