decl.c (lang_print_error_function): New fn.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 22 May 1998 23:13:28 +0000 (23:13 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 22 May 1998 23:13:28 +0000 (19:13 -0400)
* 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

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/cp/errfn.c

index da95654795162a57fdecc0401e28a7f873dcac62..023f4571f9022682335d42b8ee97012bf6c151dc 100644 (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,
index a57bc3c40ed509e4fcb4b68245b1f93070737d6e..f0bf7d816ab18ae57b6d65a34d3398302d3651d4 100644 (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;
     }
   
index 836b8ad72580112da72249b3c7330d93cafd2cc4..abf847503deb6d25e3759307a2f5646d0b459a02 100644 (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),
index a4f9e005f55036d382f0228236f9f7dfe4828cb2..aa1a419571dd710dbbc623a10cb85fffae2fedf2 100644 (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
index 761f9221e78ff67917f18ed157ef213fd7dc3214..e5bfdf4045c8753030bd1f129030b80fb588ec92 100644 (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)
     {