[cfe-commits] r154982 - /cfe/trunk/lib/Sema/SemaAccess.cpp

Francois Pichet pichet2000 at gmail.com
Tue Apr 17 20:24:38 PDT 2012


Author: fpichet
Date: Tue Apr 17 22:24:38 2012
New Revision: 154982

URL: http://llvm.org/viewvc/llvm-project?rev=154982&view=rev
Log:
As per John McCall comment:
Follow up to r154924: check that we are in a static CMethodDecl to enable the Microsoft bug emulation regarding access to protected member during PTM creation. Not just any static function.


Modified:
    cfe/trunk/lib/Sema/SemaAccess.cpp

Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=154982&r1=154981&r2=154982&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Tue Apr 17 22:24:38 2012
@@ -781,10 +781,10 @@
 
         // Emulate a MSVC bug where the creation of pointer-to-member
         // to protected member of base class is allowed but only from
-        // a static function.
-        if (S.getLangOpts().MicrosoftMode && !EC.Functions.empty() &&
-            EC.Functions.front()->getStorageClass() == SC_Static)
-           return AR_accessible;
+        // a static function member functions.
+        if (S.getLangOpts().MicrosoftMode && !EC.Functions.empty())
+          if (CXXMethodDecl* MD = dyn_cast<CXXMethodDecl>(EC.Functions.front()))
+            if (MD->isStatic()) return AR_accessible;
 
         // Despite the standard's confident wording, there is a case
         // where you can have an instance member that's neither in a





More information about the cfe-commits mailing list