This question has alreday discussed in the link unnamed namespace within named namespace but no perfect answers were provided on how to access the variables of unnamed namespace nested under named namespace in case both variables are same
Consider This Code
namespace apple {
namespace {
int a=10;
int b=10;
}
int a=20;
}
int main()
{
cout<<apple::b; //prints 10
cout<<apple::a; // prints 20
}
Unnamed namespace "variable a" is always hidden. How to access "variable a" of unnamed namespace?
Is it even legal to declare unnamed namespaces inside named namespaces?
It looks like you simply cannot qualify an unnamed namespace outside of the enclosing namespace.
Well, here's how to fix the ambiguity:
See the Live Demo.
Though I'm aware that doesn't fully answer your question (besides if it's legal to nest unnamed namespaces inside another namespace).
I'll have to investigate what the c++ standard specification with chapters 3.4 and 7.3 a bit more to give you a definite answer why it's not possible what you want to do.