-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[libc++] LWG4012: common_view::begin/end are missing the simple-view check #153674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-libcxx Author: Nhat Nguyen (changkhothuychung) Changesclose #105320 Full diff: https://github.com/llvm/llvm-project/pull/153674.diff 1 Files Affected:
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
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Please add a SFINAE test. |
libcxx/test/std/ranges/range.adaptors/range.common.view/types.h
Outdated
Show resolved
Hide resolved
libcxx/test/std/ranges/range.adaptors/range.common.view/types.h
Outdated
Show resolved
Hide resolved
@H-G-Hristov reminder ping, looks like the CI fails are unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@H-G-Hristov reminder ping, looks like the CI fails are unrelated.
Please wait for a libc++ maintainer to approve before merging.
close #105320