From c27be9b9fcdefd81b8259a894de4e345692d8cce Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Oct 1998 18:10:23 -0400 Subject: [PATCH] pt.c (instantiate_decl): Do save and restore file position. * 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 | 16 +++++++++++++++- gcc/cp/call.c | 8 ++++++-- gcc/cp/method.c | 1 + gcc/cp/pt.c | 11 ++++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7891064a3416..7bf7f57bd3af 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,4 +1,18 @@ -Tue Oct 6 00:07:14 1998 Kaveh R. Ghazi +1998-10-05 Jason Merrill + + * pt.c (instantiate_decl): Do save and restore file position. + +1998-10-05 Martin von Löwis + + * method.c (build_decl_overload_real): Clear + numeric_output_need_bar after __. + +1998-10-05 Nathan Sidwell + + * call.c (build_new_method_call): Issue 'incomplete type' error, + if class is not defined. + +1998-10-05 Kaveh R. Ghazi * call.c (build_object_call): Move declaration of variable `fn' into the scope where it is used. Don't access variable diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 31c198a2bcbd..07ed1aebdccb 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -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; } diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 2702ac597719..819fb51b821a 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -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) { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1545c069f491..83dfde549b85 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 ();