[PATCH] D86425: [flang][msvc] Avoid range-based for over initializer_list. NFC.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 23 20:05:34 PDT 2020


Meinersbur created this revision.
Meinersbur added reviewers: isuruf, DavidTruby, sscalpone, tskeith.
Meinersbur added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Meinersbur requested review of this revision.

Msvc crashes with "INTERNAL COMPILER ERROR" when iterating over an `std::initializer_list` in a constexpr constructor. Explicitly use the iterator instead.

This patch is part of the series to make flang compilable with MS Visual Studio <http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86425

Files:
  flang/include/flang/Common/enum-set.h


Index: flang/include/flang/Common/enum-set.h
===================================================================
--- flang/include/flang/Common/enum-set.h
+++ flang/include/flang/Common/enum-set.h
@@ -37,8 +37,8 @@
 
   constexpr EnumSet() {}
   constexpr EnumSet(const std::initializer_list<enumerationType> &enums) {
-    for (auto x : enums) {
-      set(x);
+    for (auto It = enums.begin(); It != enums.end(); ++It) {
+      set(*It);
     }
   }
   constexpr EnumSet(const EnumSet &) = default;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86425.287287.patch
Type: text/x-patch
Size: 502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200824/3e9e7d05/attachment.bin>


More information about the llvm-commits mailing list