diff --git a/flang/include/flang/Common/enum-class.h b/flang/include/flang/Common/enum-class.h index bb1fcfa6274c6..212e784327812 100644 --- a/flang/include/flang/Common/enum-class.h +++ b/flang/include/flang/Common/enum-class.h @@ -12,7 +12,7 @@ // enum class className { enum1, enum2, ... , enumN }; // as well as the introspective utilities // static constexpr std::size_t className_enumSize{N}; -// static inline const std::string_view EnumToString(className); +// static inline std::string_view EnumToString(className); #ifndef FORTRAN_COMMON_ENUM_CLASS_H_ #define FORTRAN_COMMON_ENUM_CLASS_H_ diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp index 8f01a3d7057e1..1343484cb3da8 100644 --- a/flang/lib/Semantics/pointer-assignment.cpp +++ b/flang/lib/Semantics/pointer-assignment.cpp @@ -10,6 +10,7 @@ #include "definable.h" #include "flang/Common/idioms.h" #include "flang/Common/restorer.h" +#include "flang/Common/template.h" #include "flang/Evaluate/characteristics.h" #include "flang/Evaluate/expression.h" #include "flang/Evaluate/fold.h" @@ -397,16 +398,8 @@ bool PointerAssignmentChecker::Check(const evaluate::ProcedureDesignator &d) { } bool PointerAssignmentChecker::Check(const evaluate::ProcedureRef &ref) { - if (auto chars{Procedure::Characterize(ref, foldingContext_)}) { - if (chars->functionResult) { - if (const auto *proc{chars->functionResult->IsProcedurePointer()}) { - return Check(ref.proc().GetName(), true, proc); - } - } - return Check(ref.proc().GetName(), true, &*chars); - } else { - return Check(ref.proc().GetName(), true, nullptr); - } + auto chars{Procedure::Characterize(ref, foldingContext_)}; + return Check(ref.proc().GetName(), true, common::GetPtrFromOptional(chars)); } // The target can be unlimited polymorphic if the pointer is, or if it is