diff options
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index da8bd8f30f6..9dd61f3608b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8347,37 +8347,37 @@ static GTY(()) struct tinst_level *last_error_tinst_level; /* We're starting to instantiate D; record the template instantiation context for diagnostics and to restore it later. */ -int +bool push_tinst_level (tree d) { + return push_tinst_level_loc (d, input_location); +} + +/* We're starting to instantiate D; record the template instantiation context + at LOC for diagnostics and to restore it later. */ + +bool +push_tinst_level_loc (tree d, location_t loc) +{ struct tinst_level *new_level; if (tinst_depth >= max_tinst_depth) { - last_error_tinst_level = current_tinst_level; - if (TREE_CODE (d) == TREE_LIST) - error ("template instantiation depth exceeds maximum of %d (use " - "-ftemplate-depth= to increase the maximum) substituting %qS", - max_tinst_depth, d); - else - error ("template instantiation depth exceeds maximum of %d (use " - "-ftemplate-depth= to increase the maximum) instantiating %qD", - max_tinst_depth, d); - - print_instantiation_context (); - - return 0; + fatal_error ("template instantiation depth exceeds maximum of %d" + " (use -ftemplate-depth= to increase the maximum)", + max_tinst_depth); + return false; } /* If the current instantiation caused problems, don't let it instantiate anything else. Do allow deduction substitution and decls usable in constant expressions. */ if (limit_bad_template_recursion (d)) - return 0; + return false; new_level = ggc_alloc<tinst_level> (); new_level->decl = d; - new_level->locus = input_location; + new_level->locus = loc; new_level->errors = errorcount+sorrycount; new_level->in_system_header_p = in_system_header_at (input_location); new_level->next = current_tinst_level; @@ -8387,7 +8387,7 @@ push_tinst_level (tree d) if (GATHER_STATISTICS && (tinst_depth > depth_reached)) depth_reached = tinst_depth; - return 1; + return true; } /* We're done instantiating this template; return to the instantiation @@ -20291,10 +20291,10 @@ instantiate_pending_templates (int retries) { tree decl = pending_templates->tinst->decl; - error ("template instantiation depth exceeds maximum of %d" - " instantiating %q+D, possibly from virtual table generation" - " (use -ftemplate-depth= to increase the maximum)", - max_tinst_depth, decl); + fatal_error ("template instantiation depth exceeds maximum of %d" + " instantiating %q+D, possibly from virtual table generation" + " (use -ftemplate-depth= to increase the maximum)", + max_tinst_depth, decl); if (TREE_CODE (decl) == FUNCTION_DECL) /* Pretend that we defined it. */ DECL_INITIAL (decl) = error_mark_node; @@ -20627,7 +20627,7 @@ get_mostly_instantiated_function_type (tree decl) /* Return truthvalue if we're processing a template different from the last one involved in diagnostics. */ -int +bool problematic_instantiation_changed (void) { return current_tinst_level != last_error_tinst_level; |