[flang-commits] [flang] c58dfbd - [flang][msvc] Avoid range-based for over initializer_list. NFC.
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Tue Sep 8 22:22:45 PDT 2020
Author: Michael Kruse
Date: 2020-09-09T00:22:36-05:00
New Revision: c58dfbdc818275dd0e8f34939a95da546c49cdf6
URL: https://github.com/llvm/llvm-project/commit/c58dfbdc818275dd0e8f34939a95da546c49cdf6
DIFF: https://github.com/llvm/llvm-project/commit/c58dfbdc818275dd0e8f34939a95da546c49cdf6.diff
LOG: [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
Added:
Modified:
flang/include/flang/Common/enum-set.h
Removed:
################################################################################
diff --git a/flang/include/flang/Common/enum-set.h b/flang/include/flang/Common/enum-set.h
index a7bdc757a1c9..5d2eda57aa81 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/flang/include/flang/Common/enum-set.h
@@ -37,8 +37,8 @@ template <typename ENUM, std::size_t BITS> class EnumSet {
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;
More information about the flang-commits
mailing list