[PATCH] libstdc++: follow std in numeric_limits<bool>::traps
Alexandre Oliva
oliva@adacore.com
Fri Apr 10 12:01:15 GMT 2026
There's a comment from 2002 suggesting that
numeric_limits<bool>::traps was in a DR, but C++ standards including
11, 17 and 23 explicitly set it to false. I suppose whatever DR that
comment referred to must have long been resolved in favor of what's in
these much newer releases of the standard. So align it with the
standards, and drop the comment.
Regstrapped on x86_64-linux-gnu. Ok to install? Not a regression
AFAICT; perhaps for stage1?
for libstdc++-v3/ChangeLog
* include/std/limits (numeric_limits<bool>::traps): Set to
false.
---
libstdc++-v3/include/std/limits | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index f0ba2851a0a2e..c160503e0a826 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -446,10 +446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
- // It is not clear what it means for a boolean type to trap.
- // This is a DR on the LWG issue list. Here, I use integer
- // promotion semantics.
- static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
+ static _GLIBCXX_USE_CONSTEXPR bool traps = false;
static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
= round_toward_zero;
--
Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/
Free Software Activist FSFLA co-founder GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!
More information about the Libstdc++
mailing list