]> granicus.if.org Git - clang/commitdiff
As Eli pointed out, it is possible that a namespace lookup is ambiguous!
authorAnders Carlsson <andersca@mac.com>
Sat, 28 Mar 2009 07:51:31 +0000 (07:51 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 28 Mar 2009 07:51:31 +0000 (07:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67932 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp
test/SemaCXX/namespace-alias.cpp

index 7f8a69e5f306cd4e7fe4d9e6b9b06627deb76d96..67c8777e3491c513e2122dfa1a89fcc45931a70d 100644 (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;
index 7d46d08678a3a7038e6f84104fb6cc2600f13c34..b05db5ffe040ecc99e6cd9a742c53a5b59cb6853 100644 (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}}
+}