When using a using namespace statement inside an anonymous namespace bring the namespace used in to the file scope? Eg:
namespace foo
{
int f() { return 1; }
}
namespace
{
using namespace foo;
}
int a()
{
return f(); // Will this compile?
}
According to 7.3.4 [namespace.udir] paragraph 4 a namespace directive is transitive:
… and according to 7.3.1.1 [namespace.unnamed] paragraph 1 there is kind of an implicit using directive for the unnamed namespace:
Thus, the answer is “yes, this is supposed to compile” (and it does with all C++ compilers I tried it with).