Add some tests to verify that we implement LWG#2837 correctly. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@294194 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2017-02-06 16:03:23 +00:00
parent c3eec461e7
commit 24597f254d
3 changed files with 16 additions and 2 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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 &lt;tgmath.h&gt;</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&amp;&amp;) 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>