pt.c (instantiate_decl): Do save and restore file position.
authorJason Merrill <jason@gcc.gnu.org>
Mon, 5 Oct 1998 22:10:23 +0000 (18:10 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 5 Oct 1998 22:10:23 +0000 (18:10 -0400)
* pt.c (instantiate_decl): Do save and restore file position.
* method.c (build_decl_overload_real): Clear
numeric_output_need_bar after __.
* call.c (build_new_method_call): Issue 'incomplete type' error,
if class is not defined.

From-SVN: r22856

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/method.c
gcc/cp/pt.c

index 7891064a34161e606f1843f771a9483b288ccad2..7bf7f57bd3af0708a7376c482f597e364ac938cc 100644 (file)
@@ -1,4 +1,18 @@
-Tue Oct  6 00:07:14 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+1998-10-05  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (instantiate_decl): Do save and restore file position.
+
+1998-10-05  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+
+       * method.c (build_decl_overload_real): Clear
+       numeric_output_need_bar after __.
+
+1998-10-05  Nathan Sidwell  <nathan@acm.org>
+
+       * call.c (build_new_method_call): Issue 'incomplete type' error,
+       if class is not defined.
+
+1998-10-05  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * call.c (build_object_call): Move declaration of variable
        `fn' into the scope where it is used.  Don't access variable
index 31c198a2bcbda2f14b4a13e7f563c8dc26485367..07ed1aebdccb675e465b9d4361778c4eddebfe86 100644 (file)
@@ -3689,8 +3689,12 @@ build_new_method_call (instance, name, args, basetype_path, flags)
       /* XXX will LOOKUP_SPECULATIVELY be needed when this is done?  */
       if (flags & LOOKUP_SPECULATIVELY)
        return NULL_TREE;
-      cp_error ("no matching function for call to `%T::%D (%A)%V'", basetype,
-               pretty_name, user_args, TREE_TYPE (TREE_TYPE (instance_ptr)));
+      if (TYPE_SIZE (basetype) == 0)
+       incomplete_type_error (instance_ptr, basetype);
+      else
+       cp_error ("no matching function for call to `%T::%D (%A)%V'",
+                 basetype, pretty_name, user_args,
+                 TREE_TYPE (TREE_TYPE (instance_ptr)));
       print_z_candidates (candidates);
       return error_mark_node;
     }
index 2702ac59771965d32af2e2b6faf9503b52733172..819fb51b821aad64ee984a0bfebcae2098cb1621 100644 (file)
@@ -1527,6 +1527,7 @@ build_decl_overload_real (dname, parms, ret_type, tparms, targs,
      and figure out its name without any extra encoding.  */
 
   OB_PUTC2 ('_', '_');
+  numeric_output_need_bar = 0;
 
   if (tparms)
     {
index 1545c069f491b5b283b842fe154c3b07a4eea8d1..83dfde549b85b0e42841d73c00947b6f1e8632ad 100644 (file)
@@ -8005,6 +8005,8 @@ instantiate_decl (d)
   tree gen_tmpl;
   int nested = in_function_p ();
   int pattern_defined;
+  int line = lineno;
+  char *file = input_filename;
 
   /* This function should only be used to instantiate templates for
      functions and static member variables.  */
@@ -8140,7 +8142,11 @@ instantiate_decl (d)
               && ! at_eof))
     {
       /* Defer all templates except inline functions used in another
-         function.  */
+         function.  We restore the source position here because it's used
+         by add_pending_template.  */
+      lineno = line;
+      input_filename = file;
+
       if (at_eof && !pattern_defined 
          && DECL_EXPLICIT_INSTANTIATION (d))
        /* [temp.explicit]
@@ -8213,6 +8219,9 @@ instantiate_decl (d)
     }
 
 out:
+  lineno = line;
+  input_filename = file;
+
   pop_from_top_level ();
   pop_tinst_level ();