[PATCH] [Sema] Proposed fix for PR 21837

Davide Italiano dccitaliano at gmail.com
Fri May 1 17:07:36 PDT 2015


Hi rsmith,

https://llvm.org/bugs/show_bug.cgi?id=21837
I hit this recently and decided to investigate a little bit.
I'm still not 100% sure if we can arrive here with Access == AS_none, though.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9451

Files:
  SemaAccess.cpp

Index: SemaAccess.cpp
===================================================================
--- SemaAccess.cpp
+++ SemaAccess.cpp
@@ -1165,6 +1165,9 @@
     accessSoFar = D->getAccess();
     const CXXRecordDecl *declaringClass = entity.getDeclaringClass();
 
+    if (accessSoFar == AS_none)
+      return diagnoseBadDirectAccess(S, EC, entity);
+
     switch (HasAccess(S, EC, declaringClass, accessSoFar, entity)) {
     // If the declaration is accessible when named in its declaring
     // class, then we must be constrained by the path.
@@ -1354,6 +1357,10 @@
     const CXXRecordDecl *DeclaringClass = Entity.getDeclaringClass();
 
     FinalAccess = Target->getAccess();
+
+    if (FinalAccess == AS_none)
+      return AR_inaccessible;
+
     switch (HasAccess(S, EC, DeclaringClass, FinalAccess, Entity)) {
     case AR_accessible:
       // Target is accessible at EC when named in its declaring class.

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9451.24843.patch
Type: text/x-patch
Size: 913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150502/0b9b7888/attachment.bin>


More information about the cfe-commits mailing list