+Fri Mar 24 12:11:24 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (duplicate_decls): Propagate DECL_ABSTRACT_VIRTUAL_P.
+
+ * pt.c (push_tinst_level): Complain if template instantiation depth
+ is greater than max_tinst_depth.
+
+ * typeck.c (common_type): Assume that we can call common_type to
+ unify the target type of a pointer.
+
+Thu Mar 23 00:48:44 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl2.c (finish_file): Don't synthesize methods at
+ finish_vtable_prevardecl time. Do synthesize methods that are not
+ used, but are public and not external.
+
+ * cvt.c (build_type_conversion): Only give an error if for_sure.
+
+ * typeck.c (comp_target_types): Only support pointer conversions if
+ nptrs > 0.
+
+Wed Mar 22 19:30:15 1995 Brendan Kehoe (brendan@lisa.cygnus.com)
+
+ * init.c (build_new): Catch use of an initializer list where it
+ shouldn't be.
+
+Wed Mar 22 16:21:07 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * init.c (build_new): Wrap alloc_expr in an RTL_EXPR if nelts is
+ non-constant.
+
+ * decl2.c: temp_name_counter is now public.
+
+ * decl.c (struct cp_function): Add temp_name_counter field.
+ (push_cp_function_context): Save it.
+ (pop_cp_function_context): Restore it.
+
+ * typeck.c (common_type): Handle unifying function types, and unify
+ unmatched things to void* with a compiler_error, rather than
+ silently like before.
+
Wed Mar 22 15:10:34 1995 Mike Stump <mrs@cygnus.com>
* decl2.c (finish_prevtable_vardecl, finish_vtable_vardecl): Revert
{
if (winner)
{
- cp_error ("ambiguous conversion from `%T' to `%T'", basetype,
- xtype);
- cp_error (" candidate conversions include `%T' and `%T'",
- TREE_VALUE (winner), TREE_VALUE (conv));
+ if (for_sure)
+ {
+ cp_error ("ambiguous conversion from `%T' to `%T'", basetype,
+ xtype);
+ cp_error (" candidate conversions include `%T' and `%T'",
+ TREE_VALUE (winner), TREE_VALUE (conv));
+ }
return NULL_TREE;
}
else
DECL_PENDING_INLINE_INFO (newdecl) = DECL_PENDING_INLINE_INFO (olddecl);
DECL_STATIC_CONSTRUCTOR (newdecl) |= DECL_STATIC_CONSTRUCTOR (olddecl);
DECL_STATIC_DESTRUCTOR (newdecl) |= DECL_STATIC_DESTRUCTOR (olddecl);
+ DECL_ABSTRACT_VIRTUAL_P (newdecl) |= DECL_ABSTRACT_VIRTUAL_P (olddecl);
}
/* Deal with C++: must preserve virtual function table size. */
int assigns_this;
int just_assigned_this;
int parms_stored;
+ int temp_name_counter;
tree named_labels;
tree shadowed_labels;
tree ctor_label;
struct cp_function *cp_function_chain;
+extern int temp_name_counter;
+
/* Save and reinitialize the variables
used during compilation of a C++ function. */
p->result_rtx = original_result_rtx;
p->base_init_insns = base_init_insns;
p->protect_list = protect_list;
+ p->temp_name_counter = temp_name_counter;
}
/* Restore the variables used during compilation of a C++ function. */
current_function_parms_stored = p->parms_stored;
original_result_rtx = p->result_rtx;
base_init_insns = p->base_init_insns;
+ temp_name_counter = p->temp_name_counter;
free (p);
}
/* Used to help generate temporary names which are unique within
a function. Reset to 0 by start_function. */
-static int temp_name_counter;
+int temp_name_counter;
/* Same, but not reset. Local temp variables and global temp variables
can have the same name. */
/* Walk to mark the inline functions we need, then output them so
that we can pick up any other tdecls that those routines need. */
walk_vtables ((void (*)())0, finish_prevtable_vardecl);
- for (vars = saved_inlines; vars; vars = TREE_CHAIN (vars))
- {
- tree decl = TREE_VALUE (vars);
-
- if (DECL_ARTIFICIAL (decl)
- && ! DECL_INITIAL (decl)
- && (TREE_USED (decl) || ! DECL_EXTERNAL (decl)))
- synthesize_method (decl);
- }
- walk_vtables ((void (*)())0, finish_prevtable_vardecl);
if (needs_cleaning == 0)
goto mess_up;
if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl))
{
- if (TREE_USED (decl))
+ if (TREE_USED (decl)
+ || (TREE_PUBLIC (decl) && ! DECL_EXTERNAL (decl)))
synthesize_method (decl);
else
{
if (TREE_CHAIN (init) != NULL_TREE)
pedwarn ("initializer list being treated as compound expression");
+ else if (TREE_CODE (init) == CONSTRUCTOR)
+ {
+ pedwarn ("initializer list appears where operand should be used");
+ init = TREE_OPERAND (init, 1);
+ }
init = build_compound_expr (init);
init = convert_for_initialization (deref, type, init, LOOKUP_NORMAL,
can't easily know the latter, just do it always. */
tree xval = make_node (RTL_EXPR);
+ /* If we want to check the value of the allocation expression,
+ and the number of elements in the array is not a constant, we
+ *must* expand the SAVE_EXPR for nelts in alloc_expr before we
+ expand it in the actual initalization. So we need to build up
+ an RTL_EXPR for alloc_expr. Sigh. */
+ if (alloc_expr && ! TREE_CONSTANT (nelts))
+ {
+ tree xval = make_node (RTL_EXPR);
+ rtx rtxval;
+ TREE_TYPE (xval) = TREE_TYPE (alloc_expr);
+ do_pending_stack_adjust ();
+ start_sequence_for_rtl_expr (xval);
+ emit_note (0, -1);
+ rtxval = expand_expr (alloc_expr, NULL, VOIDmode, 0);
+ do_pending_stack_adjust ();
+ TREE_SIDE_EFFECTS (xval) = 1;
+ RTL_EXPR_SEQUENCE (xval) = get_insns ();
+ end_sequence ();
+ RTL_EXPR_RTL (xval) = rtxval;
+ TREE_TYPE (xval) = TREE_TYPE (alloc_expr);
+ alloc_expr = xval;
+ }
+
TREE_TYPE (xval) = TREE_TYPE (rval);
do_pending_stack_adjust ();
start_sequence_for_rtl_expr (xval);
}
}
-struct tinst_level *current_tinst_level = 0;
-struct tinst_level *free_tinst_level = 0;
+static struct tinst_level *current_tinst_level = 0;
+static struct tinst_level *free_tinst_level = 0;
+static int tinst_depth = 0;
+int max_tinst_depth = 17;
-void
+int
push_tinst_level (name)
tree name;
{
struct tinst_level *new;
tree global = IDENTIFIER_GLOBAL_VALUE (name);
+ if (tinst_depth >= max_tinst_depth)
+ {
+ error ("template instantiation depth exceeds maximum of %d",
+ max_tinst_depth);
+ cp_error (" instantiating `%D'", name);
+ return 0;
+ }
+
if (free_tinst_level)
{
new = free_tinst_level;
}
new->next = current_tinst_level;
current_tinst_level = new;
+ ++tinst_depth;
+ return 1;
}
void
current_tinst_level = old->next;
old->next = free_tinst_level;
free_tinst_level = old;
+ --tinst_depth;
}
struct tinst_level *
push_to_top_level ();
template_info = DECL_TEMPLATE_INFO (t1);
- if (setup_parse)
+ if (setup_parse && push_tinst_level (classname))
{
- push_tinst_level (classname);
push_template_decls (DECL_TEMPLATE_PARMS (TREE_PURPOSE (template)),
TREE_VALUE (template), 0);
set_current_level_tags_transparency (1);
if (tt1 == tt2)
target = tt1;
- else if ((IS_AGGR_TYPE_CODE (TREE_CODE (tt1))
- || TREE_CODE (tt1) == OFFSET_TYPE
- || TREE_CODE (tt1) == METHOD_TYPE)
- && TREE_CODE (tt2) == TREE_CODE (tt1))
- target = common_type (tt1, tt2);
- else
+ else if (tt1 == void_type_node || tt2 == void_type_node)
target = void_type_node;
+ else
+ target = common_type (tt1, tt2);
target = cp_build_type_variant (target, constp, volatilep);
if (code1 == POINTER_TYPE)
if (ttl == ttr)
return 1;
- if (TREE_CODE (ttl) == VOID_TYPE
- && TREE_CODE (ttr) != FUNCTION_TYPE
- && TREE_CODE (ttr) != METHOD_TYPE
- && TREE_CODE (ttr) != OFFSET_TYPE)
- return 1;
- if (TREE_CODE (ttr) == VOID_TYPE
- && TREE_CODE (ttl) != FUNCTION_TYPE
- && TREE_CODE (ttl) != METHOD_TYPE
- && TREE_CODE (ttl) != OFFSET_TYPE)
- return -1;
-
if (TREE_CODE (ttr) != TREE_CODE (ttl))
return 0;
if (TREE_CODE (ttr) == POINTER_TYPE)
{
- if (TREE_CODE (TREE_TYPE (ttl)) == POINTER_TYPE
- || TREE_CODE (TREE_TYPE (ttl)) == ARRAY_TYPE)
- return comp_ptr_ttypes (TREE_TYPE (ttl), TREE_TYPE (ttr));
- else
- return comp_target_types (TREE_TYPE (ttl), TREE_TYPE (ttr), nptrs - 1);
+ ttl = TREE_TYPE (ttl);
+ ttr = TREE_TYPE (ttr);
+
+ if (nptrs > 0)
+ {
+ if (TREE_CODE (ttl) == POINTER_TYPE
+ || TREE_CODE (ttl) == ARRAY_TYPE)
+ return comp_ptr_ttypes (ttl, ttr);
+ else if (TREE_CODE (ttl) == VOID_TYPE
+ && TREE_CODE (ttr) != FUNCTION_TYPE
+ && TREE_CODE (ttr) != METHOD_TYPE
+ && TREE_CODE (ttr) != OFFSET_TYPE)
+ return 1;
+ else if (TREE_CODE (ttr) == VOID_TYPE
+ && TREE_CODE (ttl) != FUNCTION_TYPE
+ && TREE_CODE (ttl) != METHOD_TYPE
+ && TREE_CODE (ttl) != OFFSET_TYPE)
+ return -1;
+ }
+
+ return comp_target_types (ttl, ttr, nptrs - 1);
}
if (TREE_CODE (ttr) == REFERENCE_TYPE)