On Tue, 21 Apr 2026 at 15:10, Tomasz Kamiński <[email protected]> wrote:
>
> This implements LWG4486. integral-constant-like and constexpr-wrapper-like
> exposition-only concept duplication.
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/simd_details.h (simd::__constexpr_wrapper_like):
>         Move to...
>         * include/std/concepts (std::__constexpr_wrapper_like): Moved
>         from bits/simd_details.h.
>         * include/std/span (std::__integral_constant_like): Define in
>         terms of __constexpr_wrapper_like.
>         * testsuite/std/simd/traits_impl.cc: Added using declaration
>         for std::__constexpr_wrapper_like.
> ---
>
> Tested on x86_64-linux locally. OK for trunk/stage-1?
> I done it, to double check if they are in sync. This impacts span in C++20 
> mode,
> so maybe it is safer to keep it for stage-1. From other seems safe, i.e. 
> should
> work as soon as test passes.
>
>  libstdc++-v3/include/bits/simd_details.h       | 7 -------
>  libstdc++-v3/include/std/concepts              | 9 +++++++++
>  libstdc++-v3/include/std/span                  | 8 +++-----
>  libstdc++-v3/testsuite/std/simd/traits_impl.cc | 1 +
>  4 files changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/libstdc++-v3/include/bits/simd_details.h 
> b/libstdc++-v3/include/bits/simd_details.h
> index 31bd6ac45ab..408a344d2ec 100644
> --- a/libstdc++-v3/include/bits/simd_details.h
> +++ b/libstdc++-v3/include/bits/simd_details.h
> @@ -1030,13 +1030,6 @@ namespace simd
>    /** @internal
>     * C++26 [simd.expos]
>     */
> -  template<typename _Tp>
> -    concept __constexpr_wrapper_like
> -      = convertible_to<_Tp, decltype(_Tp::value)>
> -         && equality_comparable_with<_Tp, decltype(_Tp::value)>
> -         && bool_constant<_Tp() == _Tp::value>::value
> -         && bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == 
> _Tp::value>::value;
> -
>    // [simd.ctor] explicit(...) of broadcast ctor
>    template <auto _From, typename _To>
>      concept __non_narrowing_constexpr_conversion
> diff --git a/libstdc++-v3/include/std/concepts 
> b/libstdc++-v3/include/std/concepts
> index 7673443f33a..328096a89e3 100644
> --- a/libstdc++-v3/include/std/concepts
> +++ b/libstdc++-v3/include/std/concepts
> @@ -421,6 +421,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>                && ! requires(_Tp&& __t, _Up&& __u)
>                  { 
> static_cast<_Up&&>(__u).operator<=>(static_cast<_Tp&&>(__t)); }));
>    }
> +
> +  // [expos.only.entity]
> +  template<typename _Tp>
> +    concept __constexpr_wrapper_like
> +      = convertible_to<_Tp, decltype(_Tp::value)>
> +       && equality_comparable_with<_Tp, decltype(_Tp::value)>
> +       && bool_constant<_Tp() == _Tp::value>::value
> +       && bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == 
> _Tp::value>::value;
> +
>  _GLIBCXX_END_NAMESPACE_VERSION
>  } // namespace
>  #endif // __cpp_lib_concepts
> diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
> index a5f5bf48f90..1215ce826f6 100644
> --- a/libstdc++-v3/include/std/span
> +++ b/libstdc++-v3/include/std/span
> @@ -467,15 +467,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    {
>      // _GLIBCXX_RESOLVE_LIB_DEFECTS
>      // 4351. integral-constant-like needs more remove_cvref_t
> +    // 4486. integral-constant-like and constexpr-wrapper-like 
> exposition-only
> +    //       concept duplicatiob

Typo: duplication

OK for stage 1


>      template<typename _Tp>
>        concept __integral_constant_like =
>         is_integral_v<remove_cvref_t<decltype(_Tp::value)>>
>         && !is_same_v<bool, remove_cvref_t<decltype(_Tp::value)>>
> -       && convertible_to<_Tp, decltype(_Tp::value)>
> -       && equality_comparable_with<_Tp, decltype(_Tp::value)>
> -       && bool_constant<_Tp() == _Tp::value>::value
> -       && bool_constant<static_cast<decltype(_Tp::value)>(_Tp()) == 
> _Tp::value>
> -            ::value;
> +       && __constexpr_wrapper_like<_Tp>;
>
>      template<typename _Tp>
>        constexpr size_t __maybe_static_ext = dynamic_extent;
> diff --git a/libstdc++-v3/testsuite/std/simd/traits_impl.cc 
> b/libstdc++-v3/testsuite/std/simd/traits_impl.cc
> index f73a9e3beb5..2f705c7df2f 100644
> --- a/libstdc++-v3/testsuite/std/simd/traits_impl.cc
> +++ b/libstdc++-v3/testsuite/std/simd/traits_impl.cc
> @@ -16,6 +16,7 @@ using std::float32_t;
>  using std::float64_t;
>
>  using namespace std::simd;
> +using std::__constexpr_wrapper_like;
>
>  template <int = 0>
>  void test()
> --
> 2.53.0
>

Reply via email to