[libcxx] r178370 - Test case was forming the wrong limits when size_t != unsigned long.

Howard Hinnant hhinnant at apple.com
Fri Mar 29 14:22:23 PDT 2013


Author: hhinnant
Date: Fri Mar 29 16:22:22 2013
New Revision: 178370

URL: http://llvm.org/viewvc/llvm-project?rev=178370&view=rev
Log:
Test case was forming the wrong limits when size_t != unsigned long.

Modified:
    libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp

Modified: libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp?rev=178370&r1=178369&r2=178370&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp (original)
+++ libcxx/trunk/test/utilities/template.bitset/bitset.members/to_ulong.pass.cpp Fri Mar 29 16:22:22 2013
@@ -11,6 +11,7 @@
 
 #include <bitset>
 #include <algorithm>
+#include <limits>
 #include <climits>
 #include <cassert>
 
@@ -19,7 +20,7 @@ void test_to_ulong()
 {
     const std::size_t M = sizeof(unsigned long) * CHAR_BIT < N ? sizeof(unsigned long) * CHAR_BIT : N;
     const std::size_t X = M == 0 ? sizeof(unsigned long) * CHAR_BIT - 1 : sizeof(unsigned long) * CHAR_BIT - M;
-    const std::size_t max = M == 0 ? 0 : std::size_t(-1) >> X;
+    const std::size_t max = M == 0 ? 0 : std::size_t(std::numeric_limits<unsigned long>::max()) >> X;
     std::size_t tests[] = {0,
                            std::min<std::size_t>(1, max),
                            std::min<std::size_t>(2, max),





More information about the cfe-commits mailing list