summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
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
commita39371c0e214fca064be28baa80a94ffb57d8fbe (patch)
tree989c0e9df038d08c8d3ae32dc0e0aca71d34e0d8 /clang/lib/Sema
parent08a0598cd4436a2c618e9ec0842d5817e31c63c9 (diff)
downloadbcm5719-llvm-a39371c0e214fca064be28baa80a94ffb57d8fbe.tar.gz
bcm5719-llvm-a39371c0e214fca064be28baa80a94ffb57d8fbe.zip
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. llvm-svn: 154924
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index dea5e76d9e1..024838d4d4a 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud