From: Jason Merrill Date: Fri, 22 May 1998 23:13:28 +0000 (+0000) Subject: decl.c (lang_print_error_function): New fn. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=62c154ed39c6410c39944a8b7f6feccddc2a2946;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da956547951..023f4571f90 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,15 @@ 1998-05-22 Jason Merrill + * 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, diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a57bc3c40ed..f0bf7d816ab 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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; } diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 836b8ad7258..abf847503de 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -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), diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a4f9e005f55..aa1a419571d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 diff --git a/gcc/cp/errfn.c b/gcc/cp/errfn.c index 761f9221e78..e5bfdf4045c 100644 --- a/gcc/cp/errfn.c +++ b/gcc/cp/errfn.c @@ -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) {