[PATCH] D27691: [libcxx] [test] Fix size_t-to-int truncation warnings in syserr.hash.
Stephan T. Lavavej via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 12 16:35:14 PST 2016
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
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27691.81160.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161213/a8566c19/attachment.bin>
More information about the cfe-commits
mailing list