#include <iostream>
namespace so
{
struct foo { int x; };
inline bool do_it(foo const &, foo const &)
{
std::cout << "so" << std::endl;
return (true);
}
namespace other
{
inline static bool do_it(so::foo const &, so::foo const &)
{
std::cout << "so::other" << std::endl;
return (true);
}
static void somefunc(so::foo const & a, so::foo const & b)
{
do_it(a, b);
}
}
}
int main()
{
so::foo a_, b_;
so::other::somefunc(a_, b_);
return (0);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKbmFtZXNwYWNlIHNvCnsKc3RydWN0IGZvbyB7IGludCB4OyB9OwoKaW5saW5lIGJvb2wgZG9faXQoZm9vIGNvbnN0ICYsIGZvbyBjb25zdCAmKQp7CiBzdGQ6OmNvdXQgPDwgInNvIiA8PCBzdGQ6OmVuZGw7CiByZXR1cm4gKHRydWUpOwp9CgpuYW1lc3BhY2Ugb3RoZXIKewppbmxpbmUgc3RhdGljIGJvb2wgZG9faXQoc286OmZvbyBjb25zdCAmLCBzbzo6Zm9vIGNvbnN0ICYpCnsKIHN0ZDo6Y291dCA8PCAic286Om90aGVyIiA8PCBzdGQ6OmVuZGw7CiByZXR1cm4gKHRydWUpOwp9CgpzdGF0aWMgdm9pZCBzb21lZnVuYyhzbzo6Zm9vIGNvbnN0ICYgYSwgc286OmZvbyBjb25zdCAmIGIpCnsKIGRvX2l0KGEsIGIpOwp9Cn0KCn0KCmludCBtYWluKCkKewogc286OmZvbyBhXywgYl87Cgogc286Om90aGVyOjpzb21lZnVuYyhhXywgYl8pOwogCiByZXR1cm4gKDApOwp9
prog.cpp: In function ‘void so::other::somefunc(const so::foo&, const so::foo&)’:
prog.cpp:23:12: error: call of overloaded ‘do_it(const so::foo&, const so::foo&)’ is ambiguous
do_it(a, b);
^
prog.cpp:23:12: note: candidates are:
prog.cpp:15:20: note: bool so::other::do_it(const so::foo&, const so::foo&)
inline static bool do_it(so::foo const &, so::foo const &)
^
prog.cpp:7:13: note: bool so::do_it(const so::foo&, const so::foo&)
inline bool do_it(foo const &, foo const &)
^