https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77733
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #4)
> (In reply to Jonathan Wakely from comment #1)
> > As well as a fixit hint suggesting to use std::move it might be useful to
> > display the "<near match>" text in colour so it stands out.
>
> Good idea.
IMO the near match is misplaced. What follows the 'candidate:' should be a C++
declaration. I think it should be either:
near match candidate: void Y::foo(X&&)
or:
candidate (near match): void Y::foo(X&&)
and it would be trivial to colorize the "candidate...:" lines with same color
as "note:" or with some other color.
BTW, these diagnostics imply a hierarchy of diagnostics:
1. error: no matching function for call to ‘Y::foo(X&)’
1.1 note: candidate: void Y::foo(X&&) <near match>
1.2 note: conversion of argument 1 would be ill-formed:
1.2.1 error: cannot bind rvalue reference of type ‘X&&’ to lvalue of type ‘X’
1.3 note: candidate: void Y::foo()
1.4 note: candidate expects 0 arguments, 1 provided
1.5 note: candidate: void Y::foo(int, const X&)
1.6 note: candidate expects 2 arguments, 1 provided
1.7 note: candidate: template<class T> void Y::foo(T, X&&)
template<typename T> void foo(T, X&&);
1.8 note: template argument deduction/substitution failed:
1.8.1 note: candidate expects 2 arguments, 1 provided
2. error: not matching
...
However, this is not evident from the various "error/notes" and it gets very
confusing when errors appear within errors. I think it would be better to make
a rule that a diagnostic is a "error/warning/etc." followed by one or more
"notes". Thus, the second "error:" should really be a "note:" (why 1.8.1 is a
note but 1.2.1 is an error?)