[libcxx-commits] [libcxx] [libc++][test] Avoid narrowing operations in `pair`'s constructors for tests for `flat_(multi)map` whenever feasible (PR #131284)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 17 10:44:57 PDT 2025


================
@@ -31,19 +31,19 @@ using PC = std::pair<const int, long>;
 
 void test_copy() {
   {
-    std::flat_map<long, short> source = {{1, 2}, {2, 3}};
+    std::flat_map<long, short> source = {{1, static_cast<short>(2)}, {2, static_cast<short>(3)}};
----------------
mordante wrote:

IMO this does not improve the readability of the code. Do you have an example of the MSVC diagnostic?

https://github.com/llvm/llvm-project/pull/131284


More information about the libcxx-commits mailing list