[flang-commits] [PATCH] D88695: [flang][msvc] Rework a MSVC work-around to avoid clang warning

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Oct 1 16:53:32 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG75a5ec1bad18: [flang][msvc] Rework a MSVC work-around to avoid clang warning (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88695

Files:
  flang/lib/Evaluate/fold-implementation.h


Index: flang/lib/Evaluate/fold-implementation.h
===================================================================
--- flang/lib/Evaluate/fold-implementation.h
+++ flang/lib/Evaluate/fold-implementation.h
@@ -1154,14 +1154,20 @@
   if (auto array{ApplyElementwise(context, convert)}) {
     return *array;
   }
+  struct {
+    FoldingContext &context;
+    Convert<TO, FROMCAT> &convert;
+  } msvcWorkaround{context, convert};
   return std::visit(
-      [&context, &convert](auto &kindExpr) -> Expr<TO> {
+      [&msvcWorkaround](auto &kindExpr) -> Expr<TO> {
         using Operand = ResultType<decltype(kindExpr)>;
         // This variable is a workaround for msvc which emits an error when
         // using the FROMCAT template parameter below.
         TypeCategory constexpr FromCat{FROMCAT};
+        auto &convert{msvcWorkaround.convert};
         char buffer[64];
         if (auto value{GetScalarConstantValue<Operand>(kindExpr)}) {
+          FoldingContext &context{msvcWorkaround.context};
           if constexpr (TO::category == TypeCategory::Integer) {
             if constexpr (Operand::category == TypeCategory::Integer) {
               auto converted{Scalar<TO>::ConvertSigned(*value)};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88695.295691.patch
Type: text/x-patch
Size: 1213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201001/c05a3f8f/attachment.bin>


More information about the flang-commits mailing list