summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2012-04-17 12:35:05 +0000
committerFrancois Pichet <pichet2000@gmail.com>2012-04-17 12:35:05 +0000
commitb2d899e9ae8a48c4057a48664213948934b877fa (patch)
tree3cece7cae22cb1c166c865d0c3ff9bb0c3f50b82 /lib
parent0407a04049016bdd6fe4fda462aa199d82c750d4 (diff)
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.
This fixes a regression when parsing MFC code with clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaAccess.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp
index dea5e76d9e..024838d4d4 100644
--- a/lib/Sema/SemaAccess.cpp
+++ b/lib/Sema/SemaAccess.cpp
@@ -779,6 +779,13 @@ static AccessResult HasAccess(Sema &S,
// that the naming class has to be derived from the effective
// context.
+ // 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;
+
// Despite the standard's confident wording, there is a case
// where you can have an instance member that's neither in a
// pointer-to-member expression nor in a member access: when