STL_MSFT retitled this revision from "[libcxx] [test] Fix a size_t-to-int 
truncation warning in error_code.pass.cpp." to "[libcxx] [test] Fix 
size_t-to-int truncation warnings in syserr.hash.".
STL_MSFT updated the summary for this revision.
STL_MSFT updated this revision to Diff 81160.
STL_MSFT added a comment.

This regressed after r289363, adding that to the notes. Also, the 
error_condition test was equally affected, which I initially missed because we 
haven't implemented LWG 2686 "Why is std::hash specialized for error_code, but 
not error_condition?" yet (so the test is disabled for us).


https://reviews.llvm.org/D27691

Files:
  test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
  test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp


Index: test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
===================================================================
--- test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
+++ test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
@@ -23,16 +23,16 @@
 #include "test_macros.h"
 
 void
-test(std::size_t i)
+test(int i)
 {
     typedef std::error_condition T;
     typedef std::hash<T> H;
     static_assert((std::is_same<H::argument_type, T>::value), "" );
     static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
     H h;
     T ec(i, std::system_category());
     const std::size_t result = h(ec);
-    LIBCPP_ASSERT(result == i);
+    LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
     ((void)result); // Prevent unused warning
 }
 
Index: test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
===================================================================
--- test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -23,16 +23,16 @@
 #include "test_macros.h"
 
 void
-test(std::size_t i)
+test(int i)
 {
     typedef std::error_code T;
     typedef std::hash<T> H;
     static_assert((std::is_same<H::argument_type, T>::value), "" );
     static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
     H h;
     T ec(i, std::system_category());
     const std::size_t result = h(ec);
-    LIBCPP_ASSERT(result == i);
+    LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
     ((void)result); // Prevent unused warning
 }
 


Index: test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
===================================================================
--- test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
+++ test/std/diagnostics/syserr/syserr.hash/error_condition.pass.cpp
@@ -23,16 +23,16 @@
 #include "test_macros.h"
 
 void
-test(std::size_t i)
+test(int i)
 {
     typedef std::error_condition T;
     typedef std::hash<T> H;
     static_assert((std::is_same<H::argument_type, T>::value), "" );
     static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
     H h;
     T ec(i, std::system_category());
     const std::size_t result = h(ec);
-    LIBCPP_ASSERT(result == i);
+    LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
     ((void)result); // Prevent unused warning
 }
 
Index: test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
===================================================================
--- test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -23,16 +23,16 @@
 #include "test_macros.h"
 
 void
-test(std::size_t i)
+test(int i)
 {
     typedef std::error_code T;
     typedef std::hash<T> H;
     static_assert((std::is_same<H::argument_type, T>::value), "" );
     static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
     H h;
     T ec(i, std::system_category());
     const std::size_t result = h(ec);
-    LIBCPP_ASSERT(result == i);
+    LIBCPP_ASSERT(result == static_cast<std::size_t>(i));
     ((void)result); // Prevent unused warning
 }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D27691: [libcxx... Stephan T. Lavavej via Phabricator via cfe-commits
    • [PATCH] D27691: [l... Stephan T. Lavavej via Phabricator via cfe-commits

Reply via email to