https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96710
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-12-10 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- I would like is_scalar to be true for all scalar types such as __int20 and __float128, irrespective of whether is_integer or is_floating_point is true. They're certainly not class types, nor pointers, so they have to fit somewhere in the type system. A related issue is that on msp430 std::incrementable<__int20> is false for strict mode. Ideally all the INT_N extension types would satisfy that, maybe via something like: --- a/libstdc++-v3/include/bits/iterator_concepts.h +++ b/libstdc++-v3/include/bits/iterator_concepts.h @@ -173,15 +173,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION = make_signed_t<decltype(std::declval<_Tp>() - std::declval<_Tp>())>; }; -#if defined __STRICT_ANSI__ && defined __SIZEOF_INT128__ - // __int128 is incrementable even if !integral<__int128> - template<> - struct incrementable_traits<__int128> - { using difference_type = __int128; }; - - template<> - struct incrementable_traits<unsigned __int128> - { using difference_type = __int128; }; +#ifdef __STRICT_ANSI__ + // Types like __int128 are incrementable even if integral<__int128> is false. + // In non-strict modes they match the partial specialization above, + // but in strict modes we need this one so they satisfy std::incrementable. + template<typename _Tp> + requires (__gnu_cxx::__is_integer_nonstrict<_Tp>::__value + != std::__is_integer<_Tp>::__value) + struct incrementable_traits<_Tp> + { using difference_type = make_signed_t<Tp>; }; #endif namespace __detail @@ -556,40 +556,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __max_diff_type; class __max_size_type; - template<typename _Tp> - concept __is_signed_int128 -#if __SIZEOF_INT128__ - = same_as<_Tp, __int128>; -#else - = false; -#endif - - template<typename _Tp> - concept __is_unsigned_int128 -#if __SIZEOF_INT128__ - = same_as<_Tp, unsigned __int128>; -#else - = false; -#endif - template<typename _Tp> concept __cv_bool = same_as<const volatile _Tp, const volatile bool>; template<typename _Tp> - concept __integral_nonbool = integral<_Tp> && !__cv_bool<_Tp>; - - template<typename _Tp> - concept __is_int128 = __is_signed_int128<_Tp> || __is_unsigned_int128<_Tp>; + concept __integral_nonbool + = __gnu_cxx::__is_integer_nonstrict_v<_Tp> && !__cv_bool<_Tp>; template<typename _Tp> concept __is_integer_like = __integral_nonbool<_Tp> - || __is_int128<_Tp> || same_as<_Tp, __max_diff_type> || same_as<_Tp, __max_size_type>; template<typename _Tp> - concept __is_signed_integer_like = signed_integral<_Tp> - || __is_signed_int128<_Tp> - || same_as<_Tp, __max_diff_type>; + concept __is_signed_integer_like + = (__gnu_cxx::__is_integer_nonstrict_v<_Tp> + && bool(__gnu_cxx::__int_traits<_Tp>::__is_signed)) + || same_as<_Tp, __max_diff_type>; } // namespace ranges::__detail