aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.cc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
commit071b4126c613881f4cb25b4e5c39032964827f88 (patch)
tree7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/cp/error.cc
parent845d23f3ea08ba873197c275a8857eee7edad996 (diff)
parentcaa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff)
downloadgcc-devel/gfortran-test.zip
gcc-devel/gfortran-test.tar.gz
gcc-devel/gfortran-test.tar.bz2
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/cp/error.cc')
-rw-r--r--gcc/cp/error.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index c427163..8ef9f9e 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -250,7 +250,7 @@ erroneous_templates_t *erroneous_templates;
issue an error if we later need to instantiate the template. */
static void
-cp_adjust_diagnostic_info (diagnostics::context *context,
+cp_adjust_diagnostic_info (const diagnostics::context &context,
diagnostics::diagnostic_info *diagnostic)
{
if (diagnostic->m_kind == diagnostics::kind::error)
@@ -258,7 +258,7 @@ cp_adjust_diagnostic_info (diagnostics::context *context,
{
diagnostic->m_option_id = OPT_Wtemplate_body;
- if (context->m_permissive)
+ if (context.m_permissive)
diagnostic->m_kind = diagnostics::kind::warning;
bool existed;
@@ -3953,14 +3953,20 @@ print_instantiation_full_context (diagnostics::text_sink &text_output)
= ((!text_output.show_nesting_p ())
|| text_output.show_locations_in_nesting_p ());
char *indent = text_output.build_indent_prefix (true);
+ bool expansion_stmt_p = TREE_CODE (p->tldcl) == TEMPLATE_FOR_STMT;
pp_verbatim (text_output.get_printer (),
- p->list_p ()
+ expansion_stmt_p
+ ? G_("%s%s%sIn instantiation of %<template for%> "
+ "iteration %E:\n")
+ : p->list_p ()
? G_("%s%s%sIn substitution of %qS:\n")
: G_("%s%s%sIn instantiation of %q#D:\n"),
indent,
show_file ? LOCATION_FILE (location) : "",
show_file ? ": " : "",
- p->get_node ());
+ expansion_stmt_p
+ ? TREE_VEC_ELT (p->targs, 0)
+ : p->get_node ());
free (indent);
location = p->locus;
p = p->next;
@@ -4069,7 +4075,14 @@ print_instantiation_partial_context_line (diagnostics::text_sink &text_output,
if (t != NULL)
{
- if (t->list_p ())
+ if (TREE_CODE (t->tldcl) == TEMPLATE_FOR_STMT)
+ pp_verbatim (pp,
+ recursive_p
+ ? G_("recursively required from %<template for%> "
+ "iteration %E\n")
+ : G_("required from %<template for%> iteration %E\n"),
+ TREE_VEC_ELT (t->targs, 0));
+ else if (t->list_p ())
pp_verbatim (pp,
recursive_p
? G_("recursively required by substitution of %qS\n")