summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-27 19:01:12 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-27 19:01:12 +0000
commitaf06b977f9aaae7440032d6754729365d11f00ec (patch)
treeb0133aa480410ad0ac84ff406a26d5004dca2446 /clang/lib
parent93d35acb287038a9585e16aa72711e24112a4dc3 (diff)
downloadbcm5719-llvm-af06b977f9aaae7440032d6754729365d11f00ec.tar.gz
bcm5719-llvm-af06b977f9aaae7440032d6754729365d11f00ec.zip
It is OK to cast to a private base class if the current member belongs to the class that the private base class is a base of:
class A {}; class B : private A { void f(B *b) { A* a = b; } }; llvm-svn: 67860
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 85e1c2ed883..cc212434b79 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -55,6 +55,10 @@ bool Sema::CheckBaseClassAccess(QualType Derived, QualType Base,
const CXXBaseSpecifier *InacessibleBase = 0;
+ const CXXRecordDecl* CurrentClassDecl = 0;
+ if (CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(getCurFunctionDecl()))
+ CurrentClassDecl = MD->getParent();
+
for (BasePaths::paths_iterator Path = Paths.begin(), PathsEnd = Paths.end();
Path != PathsEnd; ++Path) {
@@ -71,8 +75,9 @@ bool Sema::CheckBaseClassAccess(QualType Derived, QualType Base,
// Nothing to do.
break;
case AS_private:
- // FIXME: Check if the current function is a member or friend.
- FoundInaccessibleBase = true;
+ // FIXME: Check if the current function/class is a friend.
+ if (CurrentClassDecl != Element->Class)
+ FoundInaccessibleBase = true;
break;
case AS_protected:
// FIXME: Implement
OpenPOWER on IntegriCloud