diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-08-29 13:52:22 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-08-29 13:52:22 +0000 |
commit | 66e5825973556c8db6fc2cf19179397506b0b101 (patch) | |
tree | 7f847135e0fc41b9b41c03c8fb0ba341eaa03b5b /gcc/tree-into-ssa.c | |
parent | 1ca7a4d457a6d4769f3e6fa9f880e58a7a2eb8c8 (diff) | |
download | gcc-66e5825973556c8db6fc2cf19179397506b0b101.zip gcc-66e5825973556c8db6fc2cf19179397506b0b101.tar.gz gcc-66e5825973556c8db6fc2cf19179397506b0b101.tar.bz2 |
C++: underline param in print_conversion_rejection (more PR c++/85110)
Consider this bogus code (from g++.dg/diagnostic/param-type-mismatch-2.C):
struct s4 { static int member_1 (int one, const char **two, float three); };
int test_4 (int first, const char *second, float third)
{
return s4::member_1 (first, second, third);
}
Before this patch, g++ emits:
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:24: note: no known conversion for argument 2 from 'const char*' to 'const char**'
With this patch, it highlights the pertinent parameter in the
"no known conversion" note:
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); };
| ~~~~~~~~~~~~~^~~
gcc/cp/ChangeLog:
PR c++/85110
* call.c (print_conversion_rejection): Add "fn" param and use it
for "no known conversion" messages to underline the pertinent
param.
(print_z_candidate): Supply "fn" to the new param above.
gcc/testsuite/ChangeLog:
PR c++/85110
* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
output to reflect underlining of pertinent parameter in decl
for "no known conversion" messages.
From-SVN: r263957
Diffstat (limited to 'gcc/tree-into-ssa.c')
0 files changed, 0 insertions, 0 deletions