[libcxx-commits] [PATCH] D112665: [libc++] Ensure valid view for view_interface template parameter

Joe Loser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 28 13:50:45 PDT 2021


jloser updated this revision to Diff 383155.
jloser added a comment.

Remove requires clause for completeness check
Remove message from `static_assert`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112665/new/

https://reviews.llvm.org/D112665

Files:
  libcxx/include/__ranges/view_interface.h


Index: libcxx/include/__ranges/view_interface.h
===================================================================
--- libcxx/include/__ranges/view_interface.h
+++ 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(sizeof(_Derived) && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>);
     return static_cast<_Derived&>(*this);
   }
 
   _LIBCPP_HIDE_FROM_ABI
   constexpr _Derived const& __derived() const noexcept {
+    static_assert(sizeof(_Derived) && derived_from<_Derived, view_interface<_Derived>> && view<_Derived>);
     return static_cast<_Derived const&>(*this);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112665.383155.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211028/25f6e2e5/attachment-0001.bin>


More information about the libcxx-commits mailing list