decl.c (lang_print_error_function): New fn.

* decl.c (lang_print_error_function): New fn.
	(init_decl_processing): Set print_error_function to use it.
	* errfn.c (cp_thing): Don't call maybe_print_template_context here.
	* call.c (maybe_handle_ref_bind): Propagate ICS_USER_FLAG and
	ICS_BAD_FLAG.
	* cvt.c (ocp_convert): Don't set LOOKUP_NO_CONVERSION for
	copy-initialization.

From-SVN: r19966
This commit is contained in:
Jason Merrill 1998-05-22 23:13:28 +00:00 committed by Jason Merrill
parent bd070e1aa9
commit 62c154ed39
5 changed files with 34 additions and 8 deletions

View File

@ -1,5 +1,15 @@
1998-05-22 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (lang_print_error_function): New fn.
(init_decl_processing): Set print_error_function to use it.
* errfn.c (cp_thing): Don't call maybe_print_template_context here.
* call.c (maybe_handle_ref_bind): Propagate ICS_USER_FLAG and
ICS_BAD_FLAG.
* cvt.c (ocp_convert): Don't set LOOKUP_NO_CONVERSION for
copy-initialization.
* class.c (build_vtable_entry): Use int_fits_type_p.
(build_vtable): Pass a signed offset to build_vtable_entry.
(prepare_fresh_vtable, modify_one_vtable, fixup_vtable_deltas1,

View File

@ -3786,11 +3786,16 @@ maybe_handle_ref_bind (ics, reference_type)
cv-qualification is subsumed by the initialization itself and
does not constitute a conversion. */
tree old_ics = *ics;
*reference_type = TREE_TYPE (TREE_TYPE (*ics));
*ics = TREE_OPERAND (*ics, 0);
if (TREE_CODE (*ics) == IDENTITY_CONV
&& is_properly_derived_from (TREE_TYPE (*ics), *reference_type))
*ics = build_conv (BASE_CONV, *reference_type, *ics);
ICS_USER_FLAG (*ics) = ICS_USER_FLAG (old_ics);
ICS_BAD_FLAG (*ics) = ICS_BAD_FLAG (old_ics);
return 1;
}

View File

@ -796,10 +796,10 @@ ocp_convert (type, expr, convtype, flags)
if ((flags & LOOKUP_ONLYCONVERTING)
&& ! (IS_AGGR_TYPE (dtype) && DERIVED_FROM_P (type, dtype)))
{
ctor = build_user_type_conversion (type, ctor, flags);
flags |= LOOKUP_NO_CONVERSION;
}
/* For copy-initialization, first we create a temp of the proper type
with a user-defined conversion sequence, then we direct-initialize
the target with the temp (see [dcl.init]). */
ctor = build_user_type_conversion (type, ctor, flags);
if (ctor)
ctor = build_method_call (NULL_TREE, ctor_identifier,
build_expr_list (NULL_TREE, ctor),

View File

@ -59,6 +59,8 @@ extern int static_labelno;
extern tree current_namespace;
extern tree global_namespace;
extern void (*print_error_function) PROTO((char *));
/* Stack of places to restore the search obstack back to. */
/* Obstack used for remembering local class declarations (like
@ -172,6 +174,7 @@ static void record_unknown_type PROTO((tree, char *));
static int member_function_or_else PROTO((tree, tree, char *));
static void bad_specifiers PROTO((tree, char *, int, int, int, int,
int));
static void lang_print_error_function PROTO((char *));
#if defined (DEBUG_CP_BINDING_LEVELS)
static void indent PROTO((void));
@ -5904,6 +5907,18 @@ init_decl_processing ()
/* Show we use EH for cleanups. */
using_eh_for_cleanups ();
print_error_function = lang_print_error_function;
}
/* Function to print any language-specific context for an error message. */
static void
lang_print_error_function (file)
char *file;
{
default_print_error_function (file);
maybe_print_template_context ();
}
/* Make a definition for a builtin function named NAME and whose data type

View File

@ -72,10 +72,6 @@ cp_thing (errfn, atarg1, format, ap)
const char *f;
tree atarg = 0;
/* We call this here so that the calls to cp_error in
print_template_context don't bash buf. */
maybe_print_template_context ();
len = strlen (format) + 1;
if (len > buflen)
{