From: Jonathan Wakely Date: Mon, 11 Oct 2021 12:28:32 +0000 (+0100) Subject: libstdc++: Fix std::numeric_limits::lowest() test for strict modes X-Git-Tag: releases/gcc-10.5.0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f11b715ba891ecc936888cc5d4d6a3fab192b5f6;p=thirdparty%2Fgcc.git 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::is_integer instead of is_integral::value. (cherry picked from commit 45ba5426c129993704a73e6ace4016eaa950d7ee) --- diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/lowest.cc index 918a4494d600..330154093654 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 -#include #include template void - do_test(std::true_type) + do_test() { T limits_min = std::numeric_limits::min(); - VERIFY( std::numeric_limits::lowest() == limits_min ); - } - -template - void - do_test(std::false_type) - { T limits_max = std::numeric_limits::max(); - VERIFY( std::numeric_limits::lowest() == -limits_max ); + if (std::numeric_limits::is_integer) + VERIFY( std::numeric_limits::lowest() == limits_min ); + else + VERIFY( std::numeric_limits::lowest() == -limits_max ); } -template - void - do_test() - { do_test(typename std::is_integral::type()); } - void test01() { do_test();