diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-12-13 16:46:04 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-12-13 16:46:04 -0500 |
commit | d6840b3143f617065a070857cb22d826d24c622b (patch) | |
tree | 7895f53620efbc9ecc0fc8d87d7e31966f7580b2 /libcpp | |
parent | b24c09bfb626271cda345f5a6f0d3a6b6480593d (diff) | |
download | gcc-d6840b3143f617065a070857cb22d826d24c622b.zip gcc-d6840b3143f617065a070857cb22d826d24c622b.tar.gz gcc-d6840b3143f617065a070857cb22d826d24c622b.tar.bz2 |
c++: note other candidates when diagnosing deletedness
With the previous two patches in place, we can now extend our
deletedness diagnostic to note the other considered candidates, e.g.:
deleted.C: In function 'int main()':
deleted.C:10:4: error: use of deleted function 'void f(int)'
10 | f(0);
| ~^~~
deleted.C:5:6: note: declared here
5 | void f(int) = delete;
| ^
deleted.C:5:6: note: candidate: 'void f(int)' (deleted)
deleted.C:6:6: note: candidate: 'void f(...)'
6 | void f(...);
| ^
deleted.C:7:6: note: candidate: 'void f(int, int)'
7 | void f(int, int);
| ^
deleted.C:7:6: note: candidate expects 2 arguments, 1 provided
These notes are controlled by a new command line flag
-fdiagnostics-all-candidates which also controls whether we note
ignored candidates more generally.
gcc/ChangeLog:
* doc/invoke.texi (C++ Dialect Options): Document
-fdiagnostics-all-candidates.
gcc/c-family/ChangeLog:
* c.opt: Add -fdiagnostics-all-candidates.
gcc/cp/ChangeLog:
* call.cc (print_z_candidates): Only print ignored candidates
when -fdiagnostics-all-candidates is set, otherwise suggest
the flag.
(build_over_call): When diagnosing deletedness, note
other candidates only if -fdiagnostics-all-candidates is
set, otherwise suggest the flag.
gcc/testsuite/ChangeLog:
* g++.dg/overload/error6.C: Pass -fdiagnostics-all-candidates.
* g++.dg/cpp0x/deleted16.C: New test.
* g++.dg/cpp0x/deleted16a.C: New test.
* g++.dg/overload/error6a.C: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions