Consider this code:
using type = long;
namespace n {
using type = long;
}
using namespace n;
int main() {
type t;
}
This compiles cleanly on Clang 3.7 and GCC 5.3, but MSVC 19* gives the following error message:
main.cpp(9): error C2872: 'type': ambiguous symbol
main.cpp(1): note: could be 'long type'
main.cpp(4): note: or 'n::type'
Is this code well-formed? What part of the standard notes whether the alias is resolved before ambiguity checks?
Note that Clang and GCC both give similar errors to MSVC if you change one of those aliases.
I'm fully aware of how qualifying the name would resolve the ambiguity, I'm just interested in what the standard has to say about this.
*- Just paste the code and run it at that link, I don't know if there's an online MSVC compiler with permalinks