Check that the alias points to a valid namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67925 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 4c8437d..7f8a69e 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1627,6 +1627,7 @@
// 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;
@@ -1693,6 +1694,20 @@
return 0;
}
+ // 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;
+ }
+
+ if (!R) {
+ Diag(NamespaceLoc, diag::err_expected_namespace_name) << SS.getRange();
+ return 0;
+ }
+
return 0;
}