summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser/MicrosoftExtensions.cpp
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/test/Parser/MicrosoftExtensions.cpp
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/test/Parser/MicrosoftExtensions.cpp')
-rw-r--r--clang/test/Parser/MicrosoftExtensions.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp
index c6b3dfd691a..3a1ffea453c 100644
--- a/clang/test/Parser/MicrosoftExtensions.cpp
+++ b/clang/test/Parser/MicrosoftExtensions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fdelayed-template-parsing
+// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing
/* Microsoft attribute tests */
[repeatable][source_annotation_attribute( Parameter|ReturnValue )]
@@ -284,3 +284,28 @@ int main () {
missing_template_keyword<int>();
}
+
+
+
+namespace access_protected_PTM {
+
+class A {
+protected:
+ void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}
+};
+
+class B : public A{
+public:
+ void test_access();
+ static void test_access_static();
+};
+
+void B::test_access() {
+ &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}
+}
+
+void B::test_access_static() {
+ &A::f;
+}
+
+} \ No newline at end of file
OpenPOWER on IntegriCloud