https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122172
--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Hans-Peter Nilsson from comment #16) > So, is this too ugly? (Please ignore the whitespace change.) > > diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h > b/libstdc++-v3/include/bits/shared_ptr_base.h > index 0c6df64b921f..cd8be8b091fe 100644 > --- a/libstdc++-v3/include/bits/shared_ptr_base.h > +++ b/libstdc++-v3/include/bits/shared_ptr_base.h > @@ -267,7 +267,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // which would cause use_count() to return bogus values. > constexpr _Atomic_word __max > = sizeof(long) > sizeof(_Atomic_word) > - ? -1 : __gnu_cxx::__int_traits<_Atomic_word>::__max; > + ? -1 : (_Atomic_word_unsigned) -1 / 2; > > if (__count == __max) [[__unlikely__]] > __builtin_trap(); I was testing the same thing locally :-)
