[PATCH] D21093: [libcxx] [test] In unord.hash/floating.pass.cpp, add a static_cast to fix a truncation warning.

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 7 12:21:27 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

In unord.hash/floating.pass.cpp, add a static_cast to fix a truncation warning.

Fixes MSVC warning C4305 "'argument': truncation from 'double' to 'const std::hash<float>::_Kty'".

http://reviews.llvm.org/D21093

Files:
  test/std/utilities/function.objects/unord.hash/floating.pass.cpp

Index: test/std/utilities/function.objects/unord.hash/floating.pass.cpp
===================================================================
--- test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -35,7 +35,7 @@
 
     std::size_t t0 = h(0.);
     std::size_t tn0 = h(-0.);
-    std::size_t tp1 = h(0.1);
+    std::size_t tp1 = h(static_cast<T>(0.1));
     std::size_t t1 = h(1);
     std::size_t tn1 = h(-1);
     std::size_t pinf = h(INFINITY);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21093.59932.patch
Type: text/x-patch
Size: 531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160607/4e708736/attachment.bin>


More information about the cfe-commits mailing list