diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h index 1414eaf14f7d6..5cdabb3056d8f 100644 --- a/flang/include/flang/Evaluate/tools.h +++ b/flang/include/flang/Evaluate/tools.h @@ -130,6 +130,14 @@ template common::IfNoLvalue>, A> AsExpr(A &&x) { return Expr>{std::move(x)}; } +template ::Result> +Expr AsExpr(Relational &&x) { + // The variant in Expr> only contains + // Relational, not other Relationals. Wrap the Relational + // in Relational before creating Expr<>. + return Expr(Relational{std::move(x)}); +} + template Expr AsExpr(Expr &&x) { static_assert(IsSpecificIntrinsicType); return std::move(x);