Skip to content

Commit 211eebf

Browse files
author
Xiaoyang Liu
authored
[libc++][ranges] remove __workaround_52970 (#85683)
## Abstract This pull request removes the `__workaround_52970` concept. This concept is a workaround for a bug described in #52970, which causes the compiler to trigger ADL on a pointer to an incomplete type in an SFINAE context. This bug is fixed in Clang 14. ## Reference - [[clang] Don't typo-fix an expression in a SFINAE context](https://reviews.llvm.org/D117603) - [[libc++] [ranges] ADL-proof the [range.access] CPOs.](https://reviews.llvm.org/D116239)
1 parent cf09b7d commit 211eebf

File tree

7 files changed

+7
-12
lines changed

7 files changed

+7
-12
lines changed

libcxx/include/__concepts/class_or_enum.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2828
template <class _Tp>
2929
concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
3030

31-
// Work around Clang bug https://llvm.org/PR52970
32-
// TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14).
33-
template <class _Tp>
34-
concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>;
35-
3631
#endif // _LIBCPP_STD_VER >= 20
3732

3833
_LIBCPP_END_NAMESPACE_STD

libcxx/include/__ranges/access.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ concept __can_borrow = is_lvalue_reference_v<_Tp> || enable_borrowed_range<remov
4141
namespace ranges {
4242
namespace __begin {
4343
template <class _Tp>
44-
concept __member_begin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
44+
concept __member_begin = __can_borrow<_Tp> && requires(_Tp&& __t) {
4545
{ _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator;
4646
};
4747

@@ -103,7 +103,7 @@ using iterator_t = decltype(ranges::begin(std::declval<_Tp&>()));
103103
namespace ranges {
104104
namespace __end {
105105
template <class _Tp>
106-
concept __member_end = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
106+
concept __member_end = __can_borrow<_Tp> && requires(_Tp&& __t) {
107107
typename iterator_t<_Tp>;
108108
{ _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>;
109109
};

libcxx/include/__ranges/data.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ template <class _Tp>
4040
concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>;
4141

4242
template <class _Tp>
43-
concept __member_data = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
43+
concept __member_data = __can_borrow<_Tp> && requires(_Tp&& __t) {
4444
{ _LIBCPP_AUTO_CAST(__t.data()) } -> __ptr_to_object;
4545
};
4646

libcxx/include/__ranges/empty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
2929
namespace ranges {
3030
namespace __empty {
3131
template <class _Tp>
32-
concept __member_empty = __workaround_52970<_Tp> && requires(_Tp&& __t) { bool(__t.empty()); };
32+
concept __member_empty = requires(_Tp&& __t) { bool(__t.empty()); };
3333

3434
template <class _Tp>
3535
concept __can_invoke_size = !__member_empty<_Tp> && requires(_Tp&& __t) { ranges::size(__t); };

libcxx/include/__ranges/rbegin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3636
namespace ranges {
3737
namespace __rbegin {
3838
template <class _Tp>
39-
concept __member_rbegin = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
39+
concept __member_rbegin = __can_borrow<_Tp> && requires(_Tp&& __t) {
4040
{ _LIBCPP_AUTO_CAST(__t.rbegin()) } -> input_or_output_iterator;
4141
};
4242

libcxx/include/__ranges/rend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
3737
namespace ranges {
3838
namespace __rend {
3939
template <class _Tp>
40-
concept __member_rend = __can_borrow<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
40+
concept __member_rend = __can_borrow<_Tp> && requires(_Tp&& __t) {
4141
ranges::rbegin(__t);
4242
{ _LIBCPP_AUTO_CAST(__t.rend()) } -> sentinel_for<decltype(ranges::rbegin(__t))>;
4343
};

libcxx/include/__ranges/size.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ template <class _Tp>
4747
concept __size_enabled = !disable_sized_range<remove_cvref_t<_Tp>>;
4848

4949
template <class _Tp>
50-
concept __member_size = __size_enabled<_Tp> && __workaround_52970<_Tp> && requires(_Tp&& __t) {
50+
concept __member_size = __size_enabled<_Tp> && requires(_Tp&& __t) {
5151
{ _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like;
5252
};
5353

0 commit comments

Comments
 (0)