[flang] Prep for review
authorpeter klausler <pklausler@nvidia.com>
Wed, 10 Oct 2018 22:27:17 +0000 (15:27 -0700)
committerpeter klausler <pklausler@nvidia.com>
Wed, 10 Oct 2018 22:27:17 +0000 (15:27 -0700)
Original-commit: flang-compiler/f18@a9439ee83cce0f698471e6647ff2371f73374502
Reviewed-on: https://github.com/flang-compiler/f18/pull/209

flang/lib/evaluate/expression.h
flang/lib/evaluate/integer.h

index dae3b0d..dab8bf0 100644 (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>>
index b3b2283..df7663e 100644 (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>) {