Access control for surrogate function calls. Required a moderately gross hack
to get the access bits set properly in conversion sets.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94744 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index f65dc4b..566e915 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2086,6 +2086,11 @@
if (Record->isInvalidDecl())
return;
+ // Set access bits correctly on the directly-declared conversions.
+ UnresolvedSetImpl *Convs = Record->getConversionFunctions();
+ for (UnresolvedSetIterator I = Convs->begin(), E = Convs->end(); I != E; ++I)
+ Convs->setAccess(I, (*I)->getAccess());
+
if (!Record->isAbstract()) {
// Collect all the pure virtual methods and see if this is an abstract
// class after all.
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 55259fc..86b1e37 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -6231,7 +6231,7 @@
= cast<CXXConversionDecl>(
Best->Conversions[0].UserDefined.ConversionFunction);
- // FIXME: access control
+ CheckMemberOperatorAccess(LParenLoc, Object, Conv, Best->getAccess());
// We selected one of the surrogate functions that converts the
// object parameter to a function pointer. Perform the conversion
@@ -6246,8 +6246,8 @@
CommaLocs, RParenLoc).release();
}
- if (getLangOptions().AccessControl)
- CheckAccess(R, Best->Function, Best->getAccess());
+ CheckMemberOperatorAccess(LParenLoc, Object,
+ Best->Function, Best->getAccess());
// We found an overloaded operator(). Build a CXXOperatorCallExpr
// that calls this method, using Object for the implicit object