Hi again, folks,

This patch is a quickie to prevent a crash when a namespace, rather than a type, is used in a nested member qualifier (a.ns::i where ns is a namespace).

Sean Hunt
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp	(revision 84243)
+++ lib/Sema/SemaExpr.cpp	(working copy)
@@ -2184,6 +2184,14 @@
       // If the member name was a qualified-id, look into the
       // nested-name-specifier.
       DC = computeDeclContext(*SS, false);
+      
+      if (!isa<TypeDecl>(DC)) {
+        assert(isa<NamespaceDecl>(DC)
+               && "Nested name specifier not a type or a namespace!");
+        Diag(SS->getBeginLoc(), diag::err_qualified_member_namespace)
+          << SS->getRange();
+        return ExprError();
+      }
 
       // FIXME: If DC is not computable, we should build a
       // CXXUnresolvedMemberExpr.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to