[libcxx-commits] [libcxx] [libcxx] Removal of narrowing conversions in `flat_[multi]{set, map}` tests for compatibility with MSVC (PR #170909)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 7 07:56:22 PST 2025
=?utf-8?q?Vojtěch?= Michal <vojta.michall at email.cz>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/170909 at github.com>
================
@@ -57,7 +57,7 @@ constexpr void test_one() {
i = m.begin(); // move-assignment
typename M::const_iterator k = i; // converting constructor
assert(i == k); // comparison
- for (int j = 0; j < 9; ++j, ++i) { // pre-increment
+ for (int j = 0; j < 9; ++j, (void)++i) { // pre-increment
----------------
frederick-vs-ja wrote:
MSVC STL's `flat_set` and `flat_multiset` have the same iterator types as its adapted container. For both changed test cases, the underlying containers' iterator types have deleted `operator,` overloads, so `void`-cast becomes necessary to defend against them.
libc++'s `flat_set` and `flat_multiset` have specifically adapted iterators which don't have deleted `operator,` overloads, so these 2 tests passed with libc++.
https://github.com/llvm/llvm-project/pull/170909
More information about the libcxx-commits
mailing list