This comes from https://reviews.llvm.org/D153003
By @rsmith, the test case is valid since:
Per [temp.type]/1.4 (http://eel.is/c++draft/temp.type#1.4),
Two template-ids are the same if [...] their corresponding template template-arguments refer to the same template.
so B<A> and B<NS::A> are the same type. The stricter "same sequence of tokens" rule doesn't apply here, because using-declarations are not definitions.
we should either (preferably) be including only the syntactic form of the base specifier (because local syntax is what the ODR covers), or the canonical type (which should be the same for both using-declarations).
Here we adopt the second suggested solutions.
For a DeclaratorDecl we should be adding D->getTypeSourceInfo()->getType() (the type as written), not D->getType() (the resolved type); for a ValueDecl that is not a DeclaratorDecl, we shouldn't include the type at all, because it wasn't written in the source code.