llvm-project/libcxx/include/__ranges
Hui Xie 20869c5ba0 [libc++] fix views::all hard error on lvalue move only views instead of SFINAE
For an lvalue reference to a move only view x, views::all(x) gives hard error because the expression inside noexcept is not well formed and it is not SFINAE friendly.

Given a move only view type `V`, and a concept

```
template <class R>
concept can_all = requires {
    std::views::all(std::declval<R>());
};
```

The expression `can_all<V&>` returns
libstdc++: false
msvc stl : false
libc++   : error: static_cast from 'V' to 'typename decay<decltype((std::forward<V &>(__t)))>::type' (aka 'V') uses deleted function
      noexcept(noexcept(_LIBCPP_AUTO_CAST(std::forward<_Tp>(__t))))

The standard spec has its own problem, the spec says it is expression equivalent to `decay-copy(E)` but the spec of `decay-copy` does not have any constraint, which means the expression `decay-copy(declval<V&>())` is well-formed and the concept `can_all<V&>` should return true and should error when instantiating the function body of decay-copy. This is clearly wrong behaviour in the spec and we will probably create an LWG issue. But the libc++'s behaviour is clearly not correct. The `noexcept` is an "extension" in libc++ which is not in the spec, but the expression inside `noexpect` triggers hard error, which is not right.

Reviewed By: #libc, ldionne, var-const

Differential Revision: https://reviews.llvm.org/D128281
2022-06-22 09:50:16 +01:00
..
access.h [libc++][NFC] Use struct instead of class for ranges::end 2022-03-22 15:36:47 -04:00
all.h [libc++] fix views::all hard error on lvalue move only views instead of SFINAE 2022-06-22 09:50:16 +01:00
common_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
concepts.h [libc++] Always enable the ranges concepts 2022-05-23 20:44:34 +02:00
copyable_box.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
counted.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
dangling.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
data.h [libc++] Always enable the ranges concepts 2022-05-23 20:44:34 +02:00
drop_view.h [libc++][ranges] Implement `views::drop`. 2022-05-10 09:31:05 -07:00
empty.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
empty_view.h [libc++] add global variable template std::views::empty 2022-04-05 18:18:16 +02:00
enable_borrowed_range.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
enable_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
filter_view.h [libc++] Implement ranges::filter_view 2022-04-13 09:03:46 -04:00
iota_view.h [libc++][NFC] Fix formatting that was incorrectly changed by D124695 2022-05-06 12:58:51 -04:00
join_view.h [libcxx][ranges] add views::join adaptor object. added test coverage to join_view 2022-04-21 13:10:46 +02:00
lazy_split_view.h [libc++][ranges] Implement `views::single`. 2022-05-06 14:27:08 -07:00
non_propagating_cache.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
owning_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
range_adaptor.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
rbegin.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
ref_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
rend.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
reverse_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
single_view.h [libc++][ranges] Implement `views::single`. 2022-05-06 14:27:08 -07:00
size.h [libc++] Always enable the ranges concepts 2022-05-23 20:44:34 +02:00
subrange.h [libc++][ranges] Implement `views::drop`. 2022-05-10 09:31:05 -07:00
take_view.h [libc++][ranges] Implement `views::take`. 2022-05-06 14:16:13 -07:00
transform_view.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
view_interface.h [libc++] Replace _LIBCPP_HAS_NO_CONCEPTS with _LIBCPP_STD_VER > 17. NFCI. 2022-03-13 12:32:06 -04:00
views.h [libc++] Revert "Protect users from relying on detail headers" & related changes 2022-03-01 08:20:24 -05:00
zip_view.h [libc++] add zip_view and views::zip for C++23 2022-04-25 12:22:22 +02:00