aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/18_support
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2021-10-11 13:28:32 +0100
committerJonathan Wakely <jwakely@redhat.com>2021-10-11 20:34:17 +0100
commit45ba5426c129993704a73e6ace4016eaa950d7ee (patch)
treedc32fb822cb6e44d385eac47ab7583671bb03571 /libstdc++-v3/testsuite/18_support
parent6b6788f8c2748060d922cc22173ff7f8500917e9 (diff)
downloadgcc-45ba5426c129993704a73e6ace4016eaa950d7ee.zip
gcc-45ba5426c129993704a73e6ace4016eaa950d7ee.tar.gz
gcc-45ba5426c129993704a73e6ace4016eaa950d7ee.tar.bz2
libstdc++: Fix std::numeric_limits::lowest() test for strict modes
This test uses std::is_integral to decide whether we are testing an integral or floating-point type. But that fails for __int128 because is_integral<__int128> is false in strict modes. By using numeric_limits::is_integer instead we get the right answer for all types that have a numeric_limits specialization. We can also simplify the test by removing the unnecessary tag dispatching. libstdc++-v3/ChangeLog: * testsuite/18_support/numeric_limits/lowest.cc: Use numeric_limits<T>::is_integer instead of is_integral<T>::value.
Diffstat (limited to 'libstdc++-v3/testsuite/18_support')
-rw-r--r--libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc20
1 files changed, 5 insertions, 15 deletions
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
index 5486696..abc967c 100644
--- a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
+++ b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc
@@ -23,30 +23,20 @@
// 18.2.1.1 template class numeric_limits
#include <limits>
-#include <type_traits>
#include <testsuite_hooks.h>
template<typename T>
void
- do_test(std::true_type)
+ do_test()
{
T limits_min = std::numeric_limits<T>::min();
- VERIFY( std::numeric_limits<T>::lowest() == limits_min );
- }
-
-template<typename T>
- void
- do_test(std::false_type)
- {
T limits_max = std::numeric_limits<T>::max();
- VERIFY( std::numeric_limits<T>::lowest() == -limits_max );
+ if (std::numeric_limits<T>::is_integer)
+ VERIFY( std::numeric_limits<T>::lowest() == limits_min );
+ else
+ VERIFY( std::numeric_limits<T>::lowest() == -limits_max );
}
-template<typename Tp>
- void
- do_test()
- { do_test<Tp>(typename std::is_integral<Tp>::type()); }
-
void test01()
{
do_test<char>();