On Thu, Aug 23, 2018 at 2:08 PM, David Malcolm <dmalc...@redhat.com> wrote:
> This is a followup to:
>
>   "[PATCH] C++: underline param in print_conversion_rejection (more PR 
> c++/85110)"
>      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01480.html
>
> to highlight the pertinent argument in a unmatched function call
> for which there is one candidate.
>
> It updates the output from:
>
> demo.cc: In function 'int test_4(int, const char*, float)':
> demo.cc:5:44: error: no matching function for call to 's4::member_1(int&, 
> const char*&, float&)'
> 5 |   return s4::member_1 (first, second, third);
>   |                                            ^
> demo.cc:1:24: note: candidate: 'static int s4::member_1(int, const char**, 
> float)'
> 1 | struct s4 { static int member_1 (int one, const char **two, float three); 
> };
>   |                        ^~~~~~~~
> demo.cc:1:56: note:   no known conversion for argument 2 from 'const char*' 
> to 'const char**'
> 1 | struct s4 { static int member_1 (int one, const char **two, float three); 
> };
>   |                                           ~~~~~~~~~~~~~^~~
>
> to:
>
> demo.cc: In function 'int test_4(int, const char*, float)':
> demo.cc:5:31: error: no matching function for call to 's4::member_1(int&, 
> const char*&, float&)'
> 5 |   return s4::member_1 (first, second, third);
>   |                               ^~~~~~

Hmm, it seems pretty subtle to just change the highlighting when the
message talks about the call as a whole.  I think if we're going to
focus in this way we might change the diagnostic to something like

error: no known conversion for argument 2 from 'const char*' to 'const char**'
note: in call to 'static int s4::member_1(int, const char**, float)'

or whatever the messages are from
convert_arguments/convert_for_initialization which already deal with
the single-candidate case for non-member functions.

Jason

Reply via email to