diff options
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/call.c | 5 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 8 | ||||
-rw-r--r-- | gcc/cp/decl.c | 15 | ||||
-rw-r--r-- | gcc/cp/errfn.c | 4 |
5 files changed, 34 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da95654..023f457 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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, diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a57bc3c..f0bf7d8 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 836b8ad..abf8475 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 a4f9e00..aa1a419 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 761f922..e5bfdf4 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) { |