What does this comment mean? Function parameters used or not are part of the function signature, so obviously would participate in any form of argument dependent lookup.
void foo(std::string x, int y);
void foo(const char* x);
Then calls to foo("bar", 0) would resolve to the first overload: the second isn't a match at all, but the first is a match with an implicit conversion from const char* to std::string. But if you removed the second parameter, including arguments at all call sites, then foo("bar") would match the second better because it doesn't involve any conversions, so it would be selected instead of the first.Boom. No longer compiles.
Yes I understand the complex and surprising rules that cause this to happen. That doesn't make them any less complex and surprising.
The callers won't find a matching signature once there is 1 less parameter. I don't see what is confusing about it.
You probably misunderstood that warning as "No callers pass this parameter", which btw would only make sense for a parameter with a default value.
I went from
void foo(A a, B b) {
// Only use a
}
...
foo(x, y);
To this void foo(A a) {
// Only use a
}
...
foo(x);
And it stopped compiling. There were no other functions called `foo` so it is nothing to do with overloading.I'll give you the answer if you want or we can leave it a mystery so you can experience how confusing that behaviour is...
[1] https://en.m.wikipedia.org/wiki/Argument-dependent_name_look...