D153359 addressed the distant source ranges in overload resolution failure, but still clang generates distant source locations when emitting fix-it hint about the addition/deletion of * and & operators.
This patch separates the fix-it emission to another note to resolve this issue.
Code Example:
void f(int n);
void g(int *p) { f(p); }Before:
source:4:18: error: no matching function for call to 'f'
4 | void g(int *p) { f(p); }
| ^
source:1:6: note: candidate function not viable: no known conversion from 'int *' to 'int' for 1st argument; dereference the argument with *
1 | void f(int n);
| ^ ~~~~~
2 |
3 |
4 | void g(int *p) { f(p); }
|
| *After:
source:4:18: error: no matching function for call to 'f'
4 | void g(int *p) { f(p); }
| ^
source:1:6: note: candidate function not viable: no known conversion from 'int *' to 'int' for 1st argument
1 | void f(int n);
| ^ ~~~~~
source:4:20: note: dereference the argument with *
4 | void g(int *p) { f(p); }
| ^
| *
Something odd is going on -- why is the note emitted twice?