Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

gcc/cp/ChangeLog:
        * call.cc (print_conversion_rejection): When we're using
        the location of the param in the decl, match the color
        in the quoted source to that of %qI in the message.

Signed-off-by: David Malcolm <dmalc...@redhat.com>
---
 gcc/cp/call.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index f820419ee4ff..d9313fafb8ae 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -3910,9 +3910,15 @@ print_conversion_rejection (location_t loc, struct 
conversion_info *info,
            from, info->to_type);
   else
     {
+      gcc_rich_location richloc (loc);
       if (TREE_CODE (fn) == FUNCTION_DECL)
-       loc = get_fndecl_argument_location (fn, info->n_arg);
-      inform (loc, "no known conversion for argument %d from %qH to %qI",
+       /* If we can show the argument of the decl, then use a
+          matching color to %qI.  */
+       richloc.set_range (0,
+                          get_fndecl_argument_location (fn, info->n_arg),
+                          SHOW_RANGE_WITH_CARET,
+                          highlight_colors::percent_i);
+      inform (&richloc, "no known conversion for argument %d from %qH to %qI",
              info->n_arg + 1, from, info->to_type);
     }
 }
-- 
2.26.3

Reply via email to