https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97383
Bug ID: 97383 Summary: Consider special asing diagnostics for customization point objects Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- Inspired by https://www.reddit.com/r/cpp/comments/j9ndx1/increased_complexity_of_c20_range_algorithms/g8ktca8 ... Errors involving C++20 CPOs mean that they are leaky abstractions: prog.cc:22:50: error: no match for call to '(const std::ranges::__sort_fn) (std::vector<Package>&, <brace-enclosed initializer list>, void (Package::*)())' The type __sort_fn is an implementation detail and ideally would not be visible to users. Would it be possible to show the name of the object std::ranges::sort instead of its type? Testcase (but the problem exists for every CPU in <algorithms> and <memory>: #include <algorithm> int cmp(int*, int*); int main() { int i[2]{}; std::ranges::sort(i, &cmp); } Output from 'g++ -std=c++20 -Wfatal-errors': s.C: In function βint main()β: s.C:8:28: error: no match for call to β(const std::ranges::__sort_fn) (int [2], int (*)(int*, int*))β 8 | std::ranges::sort(i, &cmp); | ^ compilation terminated due to -Wfatal-errors. The caret diagnostic is good and shows the useful context, but the type "(const std::ranges::__sort_fn)" is not helpful to end users.