aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-28 06:42:02 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-28 06:42:02 +0000
commit5721c68299edddd6d6dc32f6ea5441bcfa20dfd8 (patch)
treea641004c7f2a63cf9cd23ccc58416ee80e31bd27 /lib/Sema/SemaDeclCXX.cpp
parentb0b6f726ab78ca32d60c5970777ae1d383d047df (diff)
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
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--lib/Sema/SemaDeclCXX.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 4c8437deee..7f8a69e5f3 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1627,6 +1627,7 @@ 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;
@@ -1693,6 +1694,20 @@ Sema::DeclTy *Sema::ActOnNamespaceAliasDef(Scope *S,
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;
}