[flang-commits] [PATCH] D132594: [flang] Fix msvc 17.3 build.

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Aug 24 13:49:40 PDT 2022


Meinersbur updated this revision to Diff 455364.
Meinersbur added a comment.

Add source comment explaining this is a workaround


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132594

Files:
  flang/lib/Evaluate/fold-integer.cpp


Index: flang/lib/Evaluate/fold-integer.cpp
===================================================================
--- flang/lib/Evaluate/fold-integer.cpp
+++ flang/lib/Evaluate/fold-integer.cpp
@@ -798,7 +798,10 @@
                   "missing case to fold intrinsic function %s", name.c_str());
             }
             return FoldElementalIntrinsic<T, TI>(context, std::move(funcRef),
-                ScalarFunc<T, TI>([&fptr](const Scalar<TI> &i) -> Scalar<T> {
+                // `i` should be declared as `const Scalar<TI>&`.
+                // We declare it as `auto` to workaround an msvc bug:
+                // https://developercommunity.visualstudio.com/t/Regression:-nested-closure-assumes-wrong/10130223
+                ScalarFunc<T, TI>([&fptr](const auto &i) -> Scalar<T> {
                   return Scalar<T>{std::invoke(fptr, i)};
                 }));
           },


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132594.455364.patch
Type: text/x-patch
Size: 887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220824/bcc287c9/attachment.bin>


More information about the flang-commits mailing list