From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 958623972417; Thu, 10 Dec 2020 15:30:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 958623972417 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/96710] __int128 vs Date: Thu, 10 Dec 2020 15:30:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Dec 2020 15:30:04 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96710 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-12-10 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- 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 somewh= ere 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 =3D make_signed_t() - 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 =3D __int128; }; - - template<> - struct incrementable_traits - { using difference_type =3D __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::incrementab= le. + template + requires (__gnu_cxx::__is_integer_nonstrict<_Tp>::__value + !=3D std::__is_integer<_Tp>::__value) + struct incrementable_traits<_Tp> + { using difference_type =3D make_signed_t; }; #endif namespace __detail @@ -556,40 +556,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __max_diff_type; class __max_size_type; - template - concept __is_signed_int128 -#if __SIZEOF_INT128__ - =3D same_as<_Tp, __int128>; -#else - =3D false; -#endif - - template - concept __is_unsigned_int128 -#if __SIZEOF_INT128__ - =3D same_as<_Tp, unsigned __int128>; -#else - =3D false; -#endif - template concept __cv_bool =3D same_as; template - concept __integral_nonbool =3D integral<_Tp> && !__cv_bool<_Tp>; - - template - concept __is_int128 =3D __is_signed_int128<_Tp> || __is_unsigned_int128<_Tp>; + concept __integral_nonbool + =3D __gnu_cxx::__is_integer_nonstrict_v<_Tp> && !__cv_bool<_Tp>; template concept __is_integer_like =3D __integral_nonbool<_Tp> - || __is_int128<_Tp> || same_as<_Tp, __max_diff_type> || same_as<_Tp, __max_size_type>; template - concept __is_signed_integer_like =3D signed_integral<_Tp> - || __is_signed_int128<_Tp> - || same_as<_Tp, __max_diff_type>; + concept __is_signed_integer_like + =3D (__gnu_cxx::__is_integer_nonstrict_v<_Tp> + && bool(__gnu_cxx::__int_traits<_Tp>::__is_signed)) + || same_as<_Tp, __max_diff_type>; } // namespace ranges::__detail=