[flang] Prep for review

Original-commit: flang-compiler/f18@a9439ee83c
Reviewed-on: https://github.com/flang-compiler/f18/pull/209
This commit is contained in:
peter klausler 2018-10-10 15:27:17 -07:00
parent fa671ab542
commit 884d9057d0
2 changed files with 14 additions and 15 deletions

View File

@ -432,23 +432,22 @@ public:
EVALUATE_UNION_CLASS_BOILERPLATE(Expr)
explicit Expr(const Scalar<Result> &x) : u{Constant<Result>{x}} {}
template<typename INT> explicit Expr(std::enable_if_t<std::is_integral_v<INT>, INT> n) : u(Constant<Result>{
n}
} {
}
template<typename INT>
explicit Expr(std::enable_if_t<std::is_integral_v<INT>, INT> n)
: u{Constant<Result>{n}} {}
private:
using Conversions = std::variant<Convert<Result, TypeCategory::Integer>,
Convert<Result, TypeCategory::Real>>;
using Operations = std::variant<Parentheses<Result>, Negate<Result>,
Add<Result>, Subtract<Result>, Multiply<Result>, Divide<Result>,
Power<Result>, Extremum<Result>>;
using Others =
std::variant<Constant<Result>, Designator<Result>, FunctionRef<Result>>;
using Conversions = std::variant<Convert<Result, TypeCategory::Integer>,
Convert<Result, TypeCategory::Real>>;
using Operations = std::variant<Parentheses<Result>, Negate<Result>,
Add<Result>, Subtract<Result>, Multiply<Result>, Divide<Result>,
Power<Result>, Extremum<Result>>;
using Others =
std::variant<Constant<Result>, Designator<Result>, FunctionRef<Result>>;
public:
common::CombineVariants<Operations, Conversions, Others> u;
}; // namespace Fortran::evaluate
common::CombineVariants<Operations, Conversions, Others> u;
};
template<int KIND>
class Expr<Type<TypeCategory::Real, KIND>>

View File

@ -120,8 +120,8 @@ public:
// C++'s integral types can all be converted to Integer
// with silent truncation.
template<typename INT>
constexpr Integer(std::enable_if<std::is_integral_v<INT>, INT> n) {
template<typename INT> constexpr Integer(INT n) {
static_assert(std::is_integral_v<INT>);
constexpr int nBits = CHAR_BIT * sizeof n;
if constexpr (nBits < partBits) {
if constexpr (std::is_unsigned_v<INT>) {