summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2017-02-06 16:03:23 +0000
committerMarshall Clow <mclow.lists@gmail.com>2017-02-06 16:03:23 +0000
commit7a1c0efff4630e895f4ba07b94bb20e702dbb181 (patch)
tree74abdc89c7421b759fa9732f24293886e128281b /libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
parentd9fa4e95ec575d0bb171852826454032176907d4 (diff)
downloadbcm5719-llvm-7a1c0efff4630e895f4ba07b94bb20e702dbb181.tar.gz
bcm5719-llvm-7a1c0efff4630e895f4ba07b94bb20e702dbb181.zip
Add some tests to verify that we implement LWG#2837 correctly. No functional change.
llvm-svn: 294194
Diffstat (limited to 'libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp')
-rw-r--r--libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
index af065b84d1b..ddb14cd3405 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
@@ -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);
+ }
}
OpenPOWER on IntegriCloud