Please consider this code:
#include <iostream>
namespace Foo{
void ool() // Version A
{
std::cout << "Foo::ool" << std::endl;
}
inline namespace Bar{
void ool() // Version B
{
std::cout << "Foo::Bar::ool" << std::endl;
}
}
}
int main()
{
Foo::ool(); // <- error
}
Both Clang and G++ correctly mark Foo::ool
as ambiguous. I can call Foo::Bar::ool
without problem but is there a way to call the version A without changing its declaration?
I found people in similar position trying to understand what happens but I did not see a solution for this case.
I am in this situation because I have a project that includes a declaration of std::__1::pair
and std::pair
, made in different places, with std::__1
being an inline namespace. I need the code to point to the std::pair
explicitly. Is there a solution for that?
-std=c++0x
(or similar with newer compilers) to the compilation options.) What compiler version and settings are you using? – Avilla