[flang] Dodge bogus G++ 8.1.0 build warning
authorpeter klausler <pklausler@nvidia.com>
Tue, 5 Mar 2019 01:02:48 +0000 (17:02 -0800)
committerpeter klausler <pklausler@nvidia.com>
Tue, 5 Mar 2019 01:02:48 +0000 (17:02 -0800)
Original-commit: flang-compiler/f18@582c6d1eca5bc29fddadae4d25e418da4ace2c11
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false

flang/lib/evaluate/expression.cc

index 21bc222..857d876 100644 (file)
@@ -204,12 +204,11 @@ std::optional<DynamicType> ExpressionBase<A>::GetType() const {
     return std::visit(
         [](const auto &x) -> std::optional<DynamicType> {
           using Ty = std::decay_t<decltype(x)>;
-          if constexpr (std::is_same_v<Ty, BOZLiteralConstant> ||
-              std::is_same_v<Ty, NullPointer>) {
-            return std::nullopt;  // typeless really means "no type"
-          } else {
+          if constexpr (!std::is_same_v<Ty, BOZLiteralConstant> &&
+              !std::is_same_v<Ty, NullPointer>) {
             return x.GetType();
           }
+          return std::nullopt;  // typeless really means "no type"
         },
         derived().u);
   }