As Eli pointed out, it is possible that a namespace lookup is ambiguous!

llvm-svn: 67932
This commit is contained in:
Anders Carlsson 2009-03-28 07:51:31 +00:00
parent 0527eda02e
commit b81608499e
2 changed files with 7 additions and 2 deletions

View File

@ -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;

View File

@ -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}}
}