From 13545f19e0e7f1d73ae6c0b39f6b86240de509a8 Mon Sep 17 00:00:00 2001 From: Ville Voutilainen Date: Tue, 14 Nov 2017 20:11:33 +0200 Subject: Implement LWG 2733 and LWG 2759 * include/experimental/numeric (gcd): Reject cv-qualified bool. (lcm): Likewise. * include/std/numeric (gcd): Likewise. (lcm): Likewise. * testsuite/26_numerics/gcd/gcd_neg.cc: Add tests and adjust. * testsuite/26_numerics/lcm/lcm_neg.cc: Likewise. From-SVN: r254736 --- libstdc++-v3/include/std/numeric | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'libstdc++-v3/include/std') diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index 2b80419..a3a447d 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -131,10 +131,12 @@ namespace __detail constexpr common_type_t<_Mn, _Nn> gcd(_Mn __m, _Nn __n) { - static_assert(is_integral<_Mn>::value, "gcd arguments are integers"); - static_assert(is_integral<_Nn>::value, "gcd arguments are integers"); - static_assert(!is_same<_Mn, bool>::value, "gcd arguments are not bools"); - static_assert(!is_same<_Nn, bool>::value, "gcd arguments are not bools"); + static_assert(is_integral_v<_Mn>, "gcd arguments are integers"); + static_assert(is_integral_v<_Nn>, "gcd arguments are integers"); + static_assert(!is_same_v, bool>, + "gcd arguments are not bools"); + static_assert(!is_same_v, bool>, + "gcd arguments are not bools"); return __detail::__gcd(__m, __n); } @@ -143,10 +145,12 @@ namespace __detail constexpr common_type_t<_Mn, _Nn> lcm(_Mn __m, _Nn __n) { - static_assert(is_integral<_Mn>::value, "lcm arguments are integers"); - static_assert(is_integral<_Nn>::value, "lcm arguments are integers"); - static_assert(!is_same<_Mn, bool>::value, "lcm arguments are not bools"); - static_assert(!is_same<_Nn, bool>::value, "lcm arguments are not bools"); + static_assert(is_integral_v<_Mn>, "lcm arguments are integers"); + static_assert(is_integral_v<_Nn>, "lcm arguments are integers"); + static_assert(!is_same_v, bool>, + "lcm arguments are not bools"); + static_assert(!is_same_v, bool>, + "lcm arguments are not bools"); return __detail::__lcm(__m, __n); } -- cgit v1.1