From c58dfbdc818275dd0e8f34939a95da546c49cdf6 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Tue, 8 Sep 2020 21:52:23 -0500 Subject: [PATCH] [flang][msvc] Avoid range-based for over initializer_list. NFC. 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 [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]]. Reviewed By: isuruf Differential Revision: https://reviews.llvm.org/D86425 --- flang/include/flang/Common/enum-set.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flang/include/flang/Common/enum-set.h b/flang/include/flang/Common/enum-set.h index a7bdc75..5d2eda5 100644 --- a/flang/include/flang/Common/enum-set.h +++ b/flang/include/flang/Common/enum-set.h @@ -37,8 +37,8 @@ public: constexpr EnumSet() {} constexpr EnumSet(const std::initializer_list &enums) { - for (auto x : enums) { - set(x); + for (auto it{enums.begin()}; it != enums.end(); ++it) { + set(*it); } } constexpr EnumSet(const EnumSet &) = default; -- 2.7.4