From: Anders Carlsson Date: Sat, 28 Mar 2009 07:51:31 +0000 (+0000) Subject: As Eli pointed out, it is possible that a namespace lookup is ambiguous! X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1a1b306946e5730f7a47f7be920061cfd7e7259;p=clang 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 --- 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}} +}