diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-03-26 22:59:39 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-03-26 22:59:39 +0000 | 
| commit | 4667effa8bdd9df81e51e1e3219c7cd0f525af58 (patch) | |
| tree | f90f318e85822132ac5c43ecc76d7e853d5f4dbb | |
| parent | 0f250e4c5be629d58fe833a9e18585a19a29c19d (diff) | |
| download | bcm5719-llvm-4667effa8bdd9df81e51e1e3219c7cd0f525af58.tar.gz bcm5719-llvm-4667effa8bdd9df81e51e1e3219c7cd0f525af58.zip  | |
Compare namespaces properly when looking for redeclarations of
namespace aliases. Fixes PR6341.
llvm-svn: 99664
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/namespace-alias.cpp | 10 | 
2 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 1b4710e3d08..b5dc7305228 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -3736,8 +3736,10 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S,      if (NamespaceAliasDecl *AD = dyn_cast<NamespaceAliasDecl>(PrevDecl)) {        // We already have an alias with the same name that points to the same        // namespace, so don't create a new one. +      // FIXME: At some point, we'll want to create the (redundant) +      // declaration to maintain better source information.        if (!R.isAmbiguous() && !R.empty() && -          AD->getNamespace() == getNamespaceDecl(R.getFoundDecl())) +          AD->getNamespace()->Equals(getNamespaceDecl(R.getFoundDecl())))          return DeclPtrTy();      } diff --git a/clang/test/SemaCXX/namespace-alias.cpp b/clang/test/SemaCXX/namespace-alias.cpp index 06114c34cc4..3ea1ccfd9f7 100644 --- a/clang/test/SemaCXX/namespace-alias.cpp +++ b/clang/test/SemaCXX/namespace-alias.cpp @@ -1,6 +1,6 @@  // RUN: %clang_cc1 -fsyntax-only -verify %s -namespace N { }; +namespace N { struct X { }; };  namespace A = N; @@ -83,3 +83,11 @@ namespace K {      KC::func(); // expected-error {{undeclared identifier 'KC'}}    }  } + +// PR6341 +namespace A = N; +namespace N { } +namespace A = N; + +A::X nx; +  | 

