[flang-commits] [PATCH] D87728: [flang][msvc] Work around if constexpr (false) evaluation. NFC.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 16 13:01:48 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdee468622784:  [flang][msvc] Work around if constexpr (false) evaluation. NFC. (authored by Meinersbur).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87728/new/

https://reviews.llvm.org/D87728

Files:
  flang/lib/Parser/basic-parsers.h


Index: flang/lib/Parser/basic-parsers.h
===================================================================
--- flang/lib/Parser/basic-parsers.h
+++ flang/lib/Parser/basic-parsers.h
@@ -729,13 +729,7 @@
       return RESULT{};
     } else {
       if constexpr (sizeof...(PARSER) == 1) {
-        if constexpr (std::is_same_v<Success, typename PARSER::resultType...>) {
-          if (std::get<0>(parsers_).Parse(state)) {
-            return RESULT{};
-          }
-        } else if (auto arg{std::get<0>(parsers_).Parse(state)}) {
-          return RESULT{std::move(*arg)};
-        }
+        return ParseOne(state);
       } else {
         ApplyArgs<PARSER...> results;
         using Sequence = std::index_sequence_for<PARSER...>;
@@ -749,6 +743,17 @@
   }
 
 private:
+  std::optional<resultType> ParseOne(ParseState &state) const {
+    if constexpr (std::is_same_v<Success, typename PARSER::resultType...>) {
+      if (std::get<0>(parsers_).Parse(state)) {
+        return RESULT{};
+      }
+    } else if (auto arg{std::get<0>(parsers_).Parse(state)}) {
+      return RESULT{std::move(*arg)};
+    }
+    return std::nullopt;
+  }
+
   const std::tuple<PARSER...> parsers_;
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87728.292318.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200916/186c7359/attachment.bin>


More information about the flang-commits mailing list