diff options
author | Anders Carlsson <andersca@mac.com> | 2009-03-28 07:51:31 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-03-28 07:51:31 +0000 |
commit | a1a1b306946e5730f7a47f7be920061cfd7e7259 (patch) | |
tree | 6b271e722bfb46c4efa5d74453a5a6e137e76903 | |
parent | cc1f8693df4c96d7a8db585e5c05e31b8520f6c2 (diff) |
As Eli pointed out, it is possible that a namespace lookup is ambiguous!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67932 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/namespace-alias.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 7f8a69e5f3..67c8777e34 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1627,7 +1627,6 @@ Sema::DeclTy *Sema::ActOnUsingDirective(Scope *S, // Lookup namespace name. LookupResult R = LookupParsedName(S, &SS, NamespcName, LookupNamespaceName, false); - // FIXME: Can the result of a namespace lookup ever be ambiguous? if (R.isAmbiguous()) { DiagnoseAmbiguousLookup(R, NamespcName, IdentLoc); return 0; @@ -1697,7 +1696,6 @@ Sema::DeclTy *Sema::ActOnNamespaceAliasDef(Scope *S, // Lookup the namespace name. LookupResult R = LookupParsedName(S, &SS, NamespaceName, LookupNamespaceName, false); - // FIXME: Can the result of a namespace lookup ever be ambiguous? if (R.isAmbiguous()) { DiagnoseAmbiguousLookup(R, NamespaceName, NamespaceLoc); return 0; diff --git a/test/SemaCXX/namespace-alias.cpp b/test/SemaCXX/namespace-alias.cpp index 7d46d08678..b05db5ffe0 100644 --- a/test/SemaCXX/namespace-alias.cpp +++ b/test/SemaCXX/namespace-alias.cpp @@ -14,3 +14,10 @@ int i; namespace D = i; // expected-error {{expected namespace name}} namespace E = N::Foo; // expected-error {{expected namespace name}} + +namespace F { + namespace A { namespace B { } } // expected-note {{candidate found by name lookup is 'F::A::B'}} + namespace B { } // expected-note {{candidate found by name lookup is 'F::B'}} + using namespace A; + namespace D = B; // expected-error {{reference to 'B' is ambiguous}} +} |