Author: stl_msft
Date: Wed Nov 23 16:02:53 2016
New Revision: 287827

URL: http://llvm.org/viewvc/llvm-project?rev=287827&view=rev
Log:
[libcxx] [test] D27020: Fix MSVC warning C4245 "conversion from 'X' to 'Y', 
signed/unsigned mismatch", part 7/12.

When initializing unsigned integers to their maximum values, change "const T 
M(~0);" to "const T M(static_cast<T>(-1));".

~0 and -1 are equivalent, but I consider the -1 form to be significantly 
clearer (and more consistent with other tests).

Modified:
    libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
    libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
    libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
    libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp 
(original)
+++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/assign.pass.cpp 
Wed Nov 23 16:02:53 2016
@@ -37,7 +37,7 @@ test()
     test1<T, 0, 0, 0>();
     test1<T, 0, 1, 2>();
     test1<T, 1, 1, 2>();
-    const T M(~0);
+    const T M(static_cast<T>(-1));
     test1<T, 0, 0, M>();
     test1<T, 0, M-2, M>();
     test1<T, 0, M-1, M>();

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp 
(original)
+++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/copy.pass.cpp 
Wed Nov 23 16:02:53 2016
@@ -37,7 +37,7 @@ test()
     test1<T, 0, 0, 0>();
     test1<T, 0, 1, 2>();
     test1<T, 1, 1, 2>();
-    const T M(~0);
+    const T M(static_cast<T>(-1));
     test1<T, 0, 0, M>();
     test1<T, 0, M-2, M>();
     test1<T, 0, M-1, M>();

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff
==============================================================================
--- 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp 
(original)
+++ 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/default.pass.cpp 
Wed Nov 23 16:02:53 2016
@@ -36,7 +36,7 @@ test()
     test1<T, 0, 0, 0>();
     test1<T, 0, 1, 2>();
     test1<T, 1, 1, 2>();
-    const T M(~0);
+    const T M(static_cast<T>(-1));
     test1<T, 0, 0, M>();
     test1<T, 0, M-2, M>();
     test1<T, 0, M-1, M>();

Modified: 
libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp?rev=287827&r1=287826&r2=287827&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp 
(original)
+++ libcxx/trunk/test/std/numerics/rand/rand.eng/rand.eng.lcong/values.pass.cpp 
Wed Nov 23 16:02:53 2016
@@ -72,7 +72,7 @@ test()
     test1<T, 0, 0, 0>();
     test1<T, 0, 1, 2>();
     test1<T, 1, 1, 2>();
-    const T M(~0);
+    const T M(static_cast<T>(-1));
     test1<T, 0, 0, M>();
     test1<T, 0, M-2, M>();
     test1<T, 0, M-1, M>();


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to