'void a(foo)' [found using argument-dependent lookup]
Well, surprisingly MSVC has a very good error explanation:
Following the standard, inside a function the compiler look for symbols in the current namespace and in the namespace where the type of the arguments are defined.
In the first case a
is in foobar
and in the namespace of the argument type foo
: the global namespace, making it ambiguous.
In the second case a
is in foobar
but not in the namespace of the argument type bar::foo
: with is bar
.