Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions flang/include/flang/Evaluate/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ template <typename A> common::IfNoLvalue<Expr<ResultType<A>>, A> AsExpr(A &&x) {
return Expr<ResultType<A>>{std::move(x)};
}

template <typename T, typename U = typename Relational<T>::Result>
Expr<U> AsExpr(Relational<T> &&x) {
// The variant in Expr<Type<TypeCategory::Logical, KIND>> only contains
// Relational<SomeType>, not other Relational<T>s. Wrap the Relational<T>
// in Relational<SomeType> before creating Expr<>.
return Expr<U>(Relational<SomeType>{std::move(x)});
}

template <typename T> Expr<T> AsExpr(Expr<T> &&x) {
static_assert(IsSpecificIntrinsicType<T>);
return std::move(x);
Expand Down