From 4904b64bf7dc5538b06d2ba01fc1c55231c09bb8 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 11 Jul 2011 14:52:12 -0400 Subject: re PR c++/44609 (Invalid template code causes infinite loop of error messages) PR c++/44609 * cp-tree.h (struct tinst_level): Add errors field. * pt.c (neglectable_inst_p, limit_bad_template_recurson): New. (push_tinst_level): Don't start another decl in that case. (reopen_tinst_level): Adjust errors field. * decl2.c (cp_write_global_declarations): Don't complain about undefined inline if its template was defined. * mangle.c (mangle_decl_string): Handle failure from push_tinst_level. From-SVN: r176176 --- gcc/cp/decl2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/cp/decl2.c') diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 8cd51c2..d90d4b5 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3950,10 +3950,10 @@ cp_write_global_declarations (void) #pragma interface, etc.) we decided not to emit the definition here. */ && !DECL_INITIAL (decl) - /* An explicit instantiation can be used to specify - that the body is in another unit. It will have - already verified there was a definition. */ - && !DECL_EXPLICIT_INSTANTIATION (decl)) + /* Don't complain if the template was defined. */ + && !(DECL_TEMPLATE_INSTANTIATION (decl) + && DECL_INITIAL (DECL_TEMPLATE_RESULT + (template_for_substitution (decl))))) { warning (0, "inline function %q+D used but never defined", decl); /* Avoid a duplicate warning from check_global_declaration_1. */ -- cgit v1.1