// 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
-// 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 )]
missing_template_keyword<int>();
}
+
+
+\r
+namespace access_protected_PTM {\r
+\r
+class A {\r
+protected:\r
+ void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}}\r
+};\r
+\r
+class B : public A{\r
+public:\r
+ void test_access();\r
+ static void test_access_static();\r
+};\r
+\r
+void B::test_access() {\r
+ &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}}\r
+}\r
+\r
+void B::test_access_static() {\r
+ &A::f;\r
+}\r
+\r
+}
\ No newline at end of file