diff --git a/libcxx/include/__ranges/view_interface.h b/libcxx/include/__ranges/view_interface.h --- a/libcxx/include/__ranges/view_interface.h +++ b/libcxx/include/__ranges/view_interface.h @@ -43,11 +43,13 @@ class view_interface : public view_base { _LIBCPP_HIDE_FROM_ABI constexpr _Derived& __derived() noexcept { + static_assert(requires { sizeof(_Derived); } && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>, "The derived type must model derived_from> and view"); return static_cast<_Derived&>(*this); } _LIBCPP_HIDE_FROM_ABI constexpr _Derived const& __derived() const noexcept { + static_assert(requires { sizeof(_Derived); } && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>, "The derived type must model derived_from> and view"); return static_cast<_Derived const&>(*this); }