https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100990

--- Comment #3 from Simon Marchi <simark at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> This fixes the std::span constructor, but not the general problem with debug
> mode:
> 
> --- a/libstdc++-v3/include/std/span
> +++ b/libstdc++-v3/include/std/span
> @@ -194,7 +194,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>         noexcept(noexcept(__last - __first))
>         : _M_ptr(std::to_address(__first)),
>           _M_extent(static_cast<size_type>(__last - __first))
> -       { __glibcxx_requires_valid_range(__first, __last); }
> +       {
> +          if (requires { typename common_type_t<_It, _End>;  })
> +            {
> +              using _CTp = common_type_t<_It, _End>;
> +              __glibcxx_requires_valid_range(static_cast<_CTp>(__first),
> +                                             static_cast<_CTp>(__last));
> +            }
> +        }
>  
>        template<size_t _ArrayExtent>
>         requires (_Extent == dynamic_extent || _ArrayExtent == _Extent)

Well, that would already be useful for us :).

Reply via email to