before any standard header (that is before the definition of the namespace std) then the corresponding code is compiled successfully.
Compilers behave differently when encounter a using directive with a namespace that was not yet defined. This confuses users.
It is not clear from the C++ Standard what exactly the using directive declares.
It declares nothing. Compilers also behave differently for `struct A {
int x; struct x { }; }; typename A::x y;` (with GCC accepting and
clang rejecting).
A declaration does not have to declare an entity. A static_assert-declaration declares a "condition". A using-directive declares that unqualified names be treated accordingly.
Take into account that using directive is also considered for qualified name lookup.
On Sunday, October 11, 2015 at 7:26:31 PM UTC+3, Columbo wrote:A declaration does not have to declare an entity. A static_assert-declaration declares a "condition". A using-directive declares that unqualified names be treated accordingly.
In my opinion this phrase "A using-directive declares that unqualified names be treated accordingly." does not make any sense.
At no point in [namespace.udir] is it mentioned that the using directive declares anything, because it is *not a declaration*.
Your PR seems to be invalid to me. The Standard is talking about name
lookup constraints, not arbitrary potential for ill-formedness when
deciding whether or not to find a declaration.
As an example where it makes a difference in otherwise valid code: https://llvm.org/bugs/show_bug.cgi?id=8263