forked from OSchip/llvm-project
When declaring a namespace alias, ignore previous declarations that
aren't in scope. Fixes PR7014. llvm-svn: 102915
This commit is contained in:
parent
95c70ec678
commit
5cf8d67bc9
|
@ -4004,9 +4004,13 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,
|
||||||
LookupParsedName(R, S, &SS);
|
LookupParsedName(R, S, &SS);
|
||||||
|
|
||||||
// Check if we have a previous declaration with the same name.
|
// Check if we have a previous declaration with the same name.
|
||||||
if (NamedDecl *PrevDecl
|
NamedDecl *PrevDecl
|
||||||
= LookupSingleName(S, Alias, AliasLoc, LookupOrdinaryName,
|
= LookupSingleName(S, Alias, AliasLoc, LookupOrdinaryName,
|
||||||
ForRedeclaration)) {
|
ForRedeclaration);
|
||||||
|
if (PrevDecl && !isDeclInScope(PrevDecl, CurContext, S))
|
||||||
|
PrevDecl = 0;
|
||||||
|
|
||||||
|
if (PrevDecl) {
|
||||||
if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {
|
if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {
|
||||||
// We already have an alias with the same name that points to the same
|
// We already have an alias with the same name that points to the same
|
||||||
// namespace, so don't create a new one.
|
// namespace, so don't create a new one.
|
||||||
|
|
|
@ -91,3 +91,13 @@ namespace A = N;
|
||||||
|
|
||||||
A::X nx;
|
A::X nx;
|
||||||
|
|
||||||
|
namespace PR7014 {
|
||||||
|
namespace X
|
||||||
|
{
|
||||||
|
namespace Y {}
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace X;
|
||||||
|
|
||||||
|
namespace Y = X::Y;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue