void g(int& a) { std::cout<<\"int&\\n\"; } void g(int a) { std::cout<<\"int\\n\"; } int main() { int a = 2; g(a); //w
If you can cast, there is, of course a way to disambiguate the call:
g(const_cast(a));
If you insist to call the reference version, the resolution is a bit more tricky:
static_cast(g)(a);