diff options
author | John McCall <rjmccall@apple.com> | 2010-08-28 07:56:00 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-28 07:56:00 +0000 |
commit | 8c77bcb072e7fd089f39fd7e079b6d767bf583fa (patch) | |
tree | fba55288e6fc7001fd415a04c0d9422ad308c764 /test/CXX/class.access/class.protected/p1.cpp | |
parent | aaafddba8b2b7f2f601bd86fdafaefde38da469d (diff) |
When checking access control for an instance member access on
an object of type I, if the current access target is protected
when named in a class N, consider the friends of the classes P
where I <= P <= N and where a notional member of N would be
non-forbidden in P.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112358 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/class.access/class.protected/p1.cpp')
-rw-r--r-- | test/CXX/class.access/class.protected/p1.cpp | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp index 778e16aa3f..a193264213 100644 --- a/test/CXX/class.access/class.protected/p1.cpp +++ b/test/CXX/class.access/class.protected/p1.cpp @@ -329,8 +329,7 @@ namespace test8 { namespace test9 { class A { // expected-note {{member is declared here}} - protected: int foo(); // expected-note 8 {{declared}} \ - // expected-note {{member is declared here}} + protected: int foo(); // expected-note 7 {{declared}} }; class B : public A { // expected-note {{member is declared here}} @@ -338,7 +337,7 @@ namespace test9 { }; class C : protected B { // expected-note {{declared}} \ - // expected-note 6 {{constrained}} + // expected-note 9 {{constrained}} }; class D : public A { @@ -351,7 +350,7 @@ namespace test9 { static void test(B &b) { b.foo(); - b.A::foo(); // expected-error {{'foo' is a protected member}} + b.A::foo(); b.B::foo(); b.C::foo(); // expected-error {{'foo' is a protected member}} } @@ -359,8 +358,7 @@ namespace test9 { static void test(C &c) { c.foo(); // expected-error {{'foo' is a protected member}} \ // expected-error {{cannot cast}} - c.A::foo(); // expected-error {{'foo' is a protected member}} \ - // expected-error {{'A' is a protected member}} \ + c.A::foo(); // expected-error {{'A' is a protected member}} \ // expected-error {{cannot cast}} c.B::foo(); // expected-error {{'B' is a protected member}} \ // expected-error {{cannot cast}} @@ -388,3 +386,22 @@ namespace test10 { template class A<int>; } + +// rdar://problem/8360285: class.protected friendship +namespace test11 { + class A { + protected: + int foo(); + }; + + class B : public A { + friend class C; + }; + + class C { + void test() { + B b; + b.A::foo(); + } + }; +} |