[libcxx-commits] [PATCH] D141108: [libc++][test] Suppress MSVC narrowing warnings

Casey Carter via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 5 22:05:06 PST 2023


CaseyCarter created this revision.
CaseyCarter added a reviewer: huixie90.
CaseyCarter added a project: libc++.
Herald added a project: All.
CaseyCarter requested review of this revision.
Herald added a reviewer: libc++.

... in `expected` tests, by initializing `short`s with `short`s instead of `int`s.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141108

Files:
  libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp
  libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp
  libcxx/test/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp


Index: libcxx/test/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp
===================================================================
--- libcxx/test/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp
+++ libcxx/test/std/utilities/expected/expected.void/ctor/ctor.unexpect.pass.cpp
@@ -101,9 +101,9 @@
 
   // multi args
   {
-    std::expected<void, std::tuple<int, short, MoveOnly>> e(std::unexpect, 1, 2, MoveOnly(3));
+    std::expected<void, std::tuple<int, short, MoveOnly>> e(std::unexpect, 1, short{2}, MoveOnly(3));
     assert(!e.has_value());
-    assert((e.error() == std::tuple<int, short, MoveOnly>(1, 2, MoveOnly(3))));
+    assert((e.error() == std::tuple<int, short, MoveOnly>(1, short{2}, MoveOnly(3))));
   }
 
   return true;
Index: libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp
===================================================================
--- libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp
+++ libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.unexpect.pass.cpp
@@ -101,9 +101,9 @@
 
   // multi args
   {
-    std::expected<int, std::tuple<int, short, MoveOnly>> e(std::unexpect, 1, 2, MoveOnly(3));
+    std::expected<int, std::tuple<int, short, MoveOnly>> e(std::unexpect, 1, short{2}, MoveOnly(3));
     assert(!e.has_value());
-    assert((e.error() == std::tuple<int, short, MoveOnly>(1, 2, MoveOnly(3))));
+    assert((e.error() == std::tuple<int, short, MoveOnly>(1, short{2}, MoveOnly(3))));
   }
 
   return true;
Index: libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp
===================================================================
--- libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp
+++ libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.inplace.pass.cpp
@@ -101,9 +101,9 @@
 
   // multi args
   {
-    std::expected<std::tuple<int, short, MoveOnly>, int> e(std::in_place, 1, 2, MoveOnly(3));
+    std::expected<std::tuple<int, short, MoveOnly>, int> e(std::in_place, 1, short{2}, MoveOnly(3));
     assert(e.has_value());
-    assert((e.value() == std::tuple<int, short, MoveOnly>(1, 2, MoveOnly(3))));
+    assert((e.value() == std::tuple<int, short, MoveOnly>(1, short{2}, MoveOnly(3))));
   }
 
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141108.486749.patch
Type: text/x-patch
Size: 2350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230106/8bd82596/attachment.bin>


More information about the libcxx-commits mailing list