[Bug c++/95073] New: Add "did you mean" when fn declaration could be found via ADL
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 12 04:13:48 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95073
Bug ID: 95073
Summary: Add "did you mean" when fn declaration could be found
via ADL
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
namespace N {
struct X { };
void f(X);
}
void
g ()
{
extern void f(); // #1
N::X x;
f(x); // calls locally declared function #1, no ADL
}
we issue
q.C: In function ‘void g()’:
q.C:11:6: error: too many arguments to function ‘void f()’
11 | f(x);
| ^
q.C:9:15: note: declared here
9 | extern void f();
| ^
but we could do better and say
q.C:11:3: error: too many arguments to function call, expected 0, have 1; did
you mean 'N::f'?
f(x);
^
N::f
q.C:3:8: note: 'N::f' declared here
void f(X);
^
More information about the Gcc-bugs
mailing list