Mordante added a subscriber: var-const. Mordante added a comment. In D152003#4534963 <https://reviews.llvm.org/D152003#4534963>, @Fznamznon wrote:
>> What do you mean with libstdc++ is fine? > > What I mean is when I do (current patch is applied to clang): > > source/llvm-project/build/bin/clang++ -std=c++20 t.cpp -c // compilation > succeeds I see what you mean now. > What I'm seeing is that in libc++ there is a bunch of explicit static casts > in `ranges::__crend::__fn` that endup transformed: > > namespace ranges { > namespace __crend { > > struct __fn { > template <class _Tp> > requires is_lvalue_reference_v<_Tp&&> > > [[nodiscard]] _LIBCPP_HIDE_FROM_ABI > constexpr auto operator()(_Tp&& __t) const > noexcept(noexcept(ranges::rend(static_cast<const > remove_reference_t<_Tp>&>(__t)))) > -> decltype( ranges::rend(static_cast<const > remove_reference_t<_Tp>&>(__t))) > { return ranges::rend(static_cast<const > remove_reference_t<_Tp>&>(__t)); } > > > template <class _Tp> > > requires is_rvalue_reference_v<_Tp&&> > > [[nodiscard]] _LIBCPP_HIDE_FROM_ABI > constexpr auto operator()(_Tp&& __t) const > noexcept(noexcept(ranges::rend(static_cast<const _Tp&&>(__t)))) > > -> decltype( ranges::rend(static_cast<const _Tp&&>(__t))) > { return ranges::rend(static_cast<const _Tp&&>(__t)); } > }; > } // namespace __crend > > Is that expected? I'm not very familiar with ranges but looking at the standard the `static_cast` is not required. I don't think the original author intended this behaviour which you implement in this patch. (To be honest I'm a bit surprised by this change in the language. I wonder how many other (library) developers it will catch off-guard.) I agree this is a bug in libc++ and we should fix it. As mentioned I'm not too familiar with ranges. Maybe @var-const has time, otherwise we need to wait for @philnik. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152003/new/ https://reviews.llvm.org/D152003 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits