[libcxx] r294194 - Add some tests to verify that we implement LWG#2837 correctly. No functional change.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 08:03:23 PST 2017


Author: marshall
Date: Mon Feb  6 10:03:23 2017
New Revision: 294194

URL: http://llvm.org/viewvc/llvm-project?rev=294194&view=rev
Log:
Add some tests to verify that we implement LWG#2837 correctly. No functional change.

Modified:
    libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
    libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
    libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp?rev=294194&r1=294193&r2=294194&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp Mon Feb  6 10:03:23 2017
@@ -129,4 +129,11 @@ int main()
     assert((do_test<long, int>(non_cce)));
     assert((do_test<int, long long>(non_cce)));
     assert((do_test<long long, int>(non_cce)));
+
+//  LWG#2837
+    {
+        auto res = std::gcd((int64_t)1234, (int32_t)-2147483648);
+        static_assert( std::is_same<decltype(res), std::common_type<int64_t, int32_t>::type>::value, "");
+        assert(res == 2);
+    }
 }

Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp?rev=294194&r1=294193&r2=294194&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.lcm/lcm.pass.cpp Mon Feb  6 10:03:23 2017
@@ -128,4 +128,11 @@ int main()
     assert((do_test<long, int>(non_cce)));
     assert((do_test<int, long long>(non_cce)));
     assert((do_test<long long, int>(non_cce)));
+
+//  LWG#2837
+    {
+        auto res = std::lcm((int64_t)1234, (int32_t)-2147483648);
+        static_assert( std::is_same<decltype(res), std::common_type<int64_t, int32_t>::type>::value, "");
+        assert(res == -1324997410816LL);
+    }
 }

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=294194&r1=294193&r2=294194&view=diff
==============================================================================
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Mon Feb  6 10:03:23 2017
@@ -77,7 +77,7 @@
 	<tr><td><a href="http://wg21.link/LWG2826">2826</a></td><td>string_view iterators use old wording</td><td>Kona</td><td><i>Nothing to do</i></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2834">2834</a></td><td>Resolution LWG 2223 is missing wording about end iterators</td><td>Kona</td><td><i>Nothing to do</i></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2835">2835</a></td><td>LWG 2536 seems to misspecify <tgmath.h></td><td>Kona</td><td></td></tr>
-	<tr><td><a href="http://wg21.link/LWG2837">2837</a></td><td>gcd and lcm should support a wider range of input values</td><td>Kona</td><td></td></tr>
+	<tr><td><a href="http://wg21.link/LWG2837">2837</a></td><td>gcd and lcm should support a wider range of input values</td><td>Kona</td><td><i>We do this already</i></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2838">2838</a></td><td>is_literal_type specification needs a little cleanup</td><td>Kona</td><td><i>Nothing to do</i></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&&) should decay U</td><td>Kona</td><td></td></tr>
 	<tr><td><a href="http://wg21.link/LWG2850">2850</a></td><td>std::function move constructor does unnecessary work</td><td>Kona</td><td></td></tr>
@@ -111,7 +111,7 @@
 <li>2826 - Nothing to do; just moving words around</li>
 <li>2834 - Nothing to do; just moving words around</li>
 <li>2835 - I'm pretty sure we already do this.</li>
-<li>2837 - Doesn't look too hard.</li>
+<li>2837 - Added some tests to ensure we do this already.</li>
 <li>2838 - Nothing to do; just moving words around</li>
 <li>2842 - This should be easy; trick will be devising tests.</li>
 <li>2850 - I think we already do this.</li>




More information about the cfe-commits mailing list