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

Nhat Nguyen via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 14 13:37:37 PDT 2025


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

None

>From 06a6c6168ca510ed773346f57693a2b273451208 Mon Sep 17 00:00:00 2001
From: changkhothuychung <nhat7203 at gmail.com>
Date: Thu, 14 Aug 2025 16:35:58 -0400
Subject: [PATCH] initial commit

---
 libcxx/include/__ranges/common_view.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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



More information about the libcxx-commits mailing list