[flang-commits] [flang] 632fd9f - [flang] Respect inaccessibility of type-bound ASSIGNMENT(=)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Feb 13 15:58:44 PST 2023
Author: Peter Klausler
Date: 2023-02-13T15:58:31-08:00
New Revision: 632fd9fb861c5deb24a6339d76f29a22462cadd8
URL: https://github.com/llvm/llvm-project/commit/632fd9fb861c5deb24a6339d76f29a22462cadd8
DIFF: https://github.com/llvm/llvm-project/commit/632fd9fb861c5deb24a6339d76f29a22462cadd8.diff
LOG: [flang] Respect inaccessibility of type-bound ASSIGNMENT(=)
When a derived type has a PRIVATE type-bound generic binding for
a defined ASSIGNMENT(=), don't use it in scopes outside of the
module that defines the type. We already get this case right
for other type-bound generics, including defined operators,
and for non-type-bound generic interfaces, but the check was
not applied for this case.
Differential Revision: https://reviews.llvm.org/D143826
Added:
Modified:
flang/lib/Semantics/expression.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 8f20fc73a3a1..62f70f1c5bf6 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -4038,18 +4038,16 @@ std::optional<ProcedureRef> ArgumentAnalyzer::GetDefinedAssignmentProc() {
auto restorer{context_.GetContextualMessages().DiscardMessages()};
if (const Symbol *symbol{scope.FindSymbol(oprName)}) {
ExpressionAnalyzer::AdjustActuals noAdjustment;
- auto pair{context_.ResolveGeneric(*symbol, actuals_, noAdjustment, true)};
- if (pair.first) {
- proc = pair.first;
- } else {
- context_.EmitGenericResolutionError(*symbol, pair.second, true);
- }
+ proc =
+ context_.ResolveGeneric(*symbol, actuals_, noAdjustment, true).first;
}
for (std::size_t i{0}; !proc && i < actuals_.size(); ++i) {
const Symbol *generic{nullptr};
if (const Symbol *binding{FindBoundOp(oprName, i, generic, true)}) {
- if (const Symbol *resolution{
- GetBindingResolution(GetType(i), *binding)}) {
+ if (CheckAccessibleSymbol(scope, DEREF(generic))) {
+ // ignore inaccessible type-bound ASSIGNMENT(=) generic
+ } else if (const Symbol *
+ resolution{GetBindingResolution(GetType(i), *binding)}) {
proc = resolution;
} else {
proc = binding;
More information about the flang-commits
mailing list