aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/numeric
diff options
context:
space:
mode:
authorVille Voutilainen <ville.voutilainen@gmail.com>2017-11-14 20:11:33 +0200
committerVille Voutilainen <ville@gcc.gnu.org>2017-11-14 20:11:33 +0200
commit13545f19e0e7f1d73ae6c0b39f6b86240de509a8 (patch)
tree7722acdb4f0bcb6fdcb8ef9545dbbfb719e46a78 /libstdc++-v3/include/std/numeric
parentd2e9196e5f8849bac2d4fa7fa5599eb2338c76bd (diff)
downloadgcc-13545f19e0e7f1d73ae6c0b39f6b86240de509a8.zip
gcc-13545f19e0e7f1d73ae6c0b39f6b86240de509a8.tar.gz
gcc-13545f19e0e7f1d73ae6c0b39f6b86240de509a8.tar.bz2
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
Diffstat (limited to 'libstdc++-v3/include/std/numeric')
-rw-r--r--libstdc++-v3/include/std/numeric20
1 files changed, 12 insertions, 8 deletions
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<remove_cv_t<_Mn>, bool>,
+ "gcd arguments are not bools");
+ static_assert(!is_same_v<remove_cv<_Nn>, 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<remove_cv_t<_Mn>, bool>,
+ "lcm arguments are not bools");
+ static_assert(!is_same_v<remove_cv_t<_Nn>, bool>,
+ "lcm arguments are not bools");
return __detail::__lcm(__m, __n);
}