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
This commit is contained in:
Jason Merrill 1999-11-16 05:58:53 +00:00 committed by Jason Merrill
parent 63408827c4
commit c95cd22e91
4 changed files with 20 additions and 12 deletions

View File

@ -1,5 +1,9 @@
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
function, add a TAG_DEFN.
* pt.c (lookup_template_class): If this is a local class in a

View File

@ -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));

View File

@ -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 ();

View File

@ -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: