[libcxx-commits] [libcxx] [libc++] LWG4012: common_view::begin/end are missing the simple-view check (PR #153674)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 14 13:38:08 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nhat Nguyen  (changkhothuychung)

<details>
<summary>Changes</summary>

close #<!-- -->105320

---
Full diff: https://github.com/llvm/llvm-project/pull/153674.diff


1 Files Affected:

- (modified) libcxx/include/__ranges/common_view.h (+2-2) 


``````````diff
diff --git a/libcxx/include/__ranges/common_view.h b/libcxx/include/__ranges/common_view.h
index 133236dd1d78a..ff26a78c00052 100644
--- a/libcxx/include/__ranges/common_view.h
+++ b/libcxx/include/__ranges/common_view.h
@@ -58,7 +58,7 @@ class common_view : public view_interface<common_view<_View>> {
 
   _LIBCPP_HIDE_FROM_ABI constexpr _View base() && { return std::move(__base_); }
 
-  _LIBCPP_HIDE_FROM_ABI constexpr auto begin() {
+  _LIBCPP_HIDE_FROM_ABI constexpr auto begin() requires (!__simple_view<_View>) {
     if constexpr (random_access_range<_View> && sized_range<_View>)
       return ranges::begin(__base_);
     else
@@ -74,7 +74,7 @@ class common_view : public view_interface<common_view<_View>> {
       return common_iterator<iterator_t<const _View>, sentinel_t<const _View>>(ranges::begin(__base_));
   }
 
-  _LIBCPP_HIDE_FROM_ABI constexpr auto end() {
+  _LIBCPP_HIDE_FROM_ABI constexpr auto end() requires (!__simple_view<_View>) {
     if constexpr (random_access_range<_View> && sized_range<_View>)
       return ranges::begin(__base_) + ranges::size(__base_);
     else

``````````

</details>


https://github.com/llvm/llvm-project/pull/153674


More information about the libcxx-commits mailing list