Qualified lookup through using declarations.  Diagnose a new type of ambiguity.
Split the various ambiguous result enumerators into their own enum.  Tests
for most of C++ [namespace.qual].



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83700 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 6767712..6a5db5f 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -194,7 +194,13 @@
   case DeclSpec::TST_union:
   case DeclSpec::TST_struct: {
     Decl *D = static_cast<Decl *>(DS.getTypeRep());
-    assert(D && "Didn't get a decl for a class/enum/union/struct?");
+    if (!D) {
+      // This can happen in C++ with ambiguous lookups.
+      Result = Context.IntTy;
+      isInvalid = true;
+      break;
+    }
+
     assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 &&
            DS.getTypeSpecSign() == 0 &&
            "Can't handle qualifiers on typedef names yet!");