diff --git a/flang/include/flang/Semantics/type.h b/flang/include/flang/Semantics/type.h index 1292c381b65f7..3522191502059 100644 --- a/flang/include/flang/Semantics/type.h +++ b/flang/include/flang/Semantics/type.h @@ -29,6 +29,13 @@ namespace Fortran::parser { struct Keyword; } +namespace Fortran::evaluate { // avoid including all of Evaluate/tools.h +template +std::optional AreEquivalentInInterface(const Expr &, const Expr &); +extern template std::optional AreEquivalentInInterface( + const Expr &, const Expr &); +} // namespace Fortran::evaluate + namespace Fortran::semantics { class Scope; @@ -110,7 +117,11 @@ class ParamValue { return category_ == that.category_ && expr_ == that.expr_; } bool operator!=(const ParamValue &that) const { return !(*this == that); } - bool IsEquivalentInInterface(const ParamValue &) const; + bool IsEquivalentInInterface(const ParamValue &that) const { + return (category_ == that.category_ && + expr_.has_value() == that.expr_.has_value() && + (!expr_ || evaluate::AreEquivalentInInterface(*expr_, *that.expr_))); + } std::string AsFortran() const; private: diff --git a/flang/lib/Semantics/type.cpp b/flang/lib/Semantics/type.cpp index 7f5f4e98a7d6c..e867d7ad6e253 100644 --- a/flang/lib/Semantics/type.cpp +++ b/flang/lib/Semantics/type.cpp @@ -758,12 +758,6 @@ void ParamValue::SetExplicit(SomeIntExpr &&x) { expr_ = std::move(x); } -bool ParamValue::IsEquivalentInInterface(const ParamValue &that) const { - return (category_ == that.category_ && - expr_.has_value() == that.expr_.has_value() && - (!expr_ || evaluate::AreEquivalentInInterface(*expr_, *that.expr_))); -} - std::string ParamValue::AsFortran() const { switch (category_) { SWITCH_COVERS_ALL_CASES