From 15269a8796029390c009f5ed97963687ad57249a Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Thu, 31 Jul 2014 01:18:05 +0000 Subject: [PATCH] Fix numeric_limits::is_modulo for signed arithmetic types. We were reporting true, for all arithmetic types, which is incorrect. Fix the tests which were wrong, too. This fixes PR#20158. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214371 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/limits | 2 +- .../numeric.limits.members/is_modulo.pass.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/limits b/include/limits index 22169665..1acf03e3 100644 --- a/include/limits +++ b/include/limits @@ -235,7 +235,7 @@ protected: static _LIBCPP_CONSTEXPR const bool is_iec559 = false; static _LIBCPP_CONSTEXPR const bool is_bounded = true; - static _LIBCPP_CONSTEXPR const bool is_modulo = true; + static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value; #if __i386__ || __x86_64__ static _LIBCPP_CONSTEXPR const bool traps = true; diff --git a/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp b/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp index fadc0156..6a609963 100644 --- a/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp +++ b/test/language.support/support.limits/limits/numeric.limits.members/is_modulo.pass.cpp @@ -26,24 +26,24 @@ test() int main() { test(); - test(); - test(); +// test(); // don't know + test(); test(); - test(); +// test(); // don't know #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS test(); test(); #endif // _LIBCPP_HAS_NO_UNICODE_CHARS - test(); + test(); test(); - test(); + test(); test(); - test(); + test(); test(); - test(); + test(); test(); #ifndef _LIBCPP_HAS_NO_INT128 - test<__int128_t, true>(); + test<__int128_t, false>(); test<__uint128_t, true>(); #endif test();