Skip to content

Commit 6eb5d55

Browse files
committed
[libcxx] fixes up some [concepts]-related code
* moves `std::copy_constructible` so it comes before `std::equality_comparable_with` * replaces a few uses of `auto`
1 parent 063b19d commit 6eb5d55

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

libcxx/include/concepts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ template<class _Tp>
243243
concept move_constructible =
244244
constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;
245245

246+
// [concept.copyconstructible]
247+
template<class _Tp>
248+
concept copy_constructible =
249+
move_constructible<_Tp> &&
250+
constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&
251+
constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&
252+
constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
253+
246254
// [concept.booleantestable]
247255
template<class _Tp>
248256
concept __boolean_testable_impl = convertible_to<_Tp, bool>;
@@ -275,14 +283,6 @@ concept equality_comparable_with =
275283
const remove_reference_t<_Up>&>> &&
276284
__weakly_equality_comparable_with<_Tp, _Up>;
277285

278-
// [concept.copyconstructible]
279-
template<class _Tp>
280-
concept copy_constructible =
281-
move_constructible<_Tp> &&
282-
constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&
283-
constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&
284-
constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
285-
286286
// [concept.invocable]
287287
template<class _Fn, class... _Args>
288288
concept invocable = requires(_Fn&& __fn, _Args&&... __args) {

libcxx/test/std/concepts/callable/invocable.compile.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ int main(int, char**) {
4949
NotInvocable(&A::F);
5050

5151
{
52-
auto X = A{};
52+
A X;
5353
ModelsInvocable(&A::I, X);
5454
ModelsInvocable(&A::F, X);
5555
ModelsInvocable(&A::G, X, 0);
5656
NotInvocable(&A::G, X);
5757
NotInvocable(&A::G, 0);
5858
NotInvocable(&A::H);
5959

60-
auto const& Y = X;
60+
A const& Y = X;
6161
ModelsInvocable(&A::I, Y);
6262
ModelsInvocable(&A::F, Y);
6363
NotInvocable(&A::G, Y, 0);

libcxx/test/std/concepts/callable/regularinvocable.compile.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ int main(int, char**) {
4848
NotRegularInvocable(&A::F);
4949

5050
{
51-
auto X = A{};
51+
A X;
5252
ModelsRegularInvocable(&A::I, X);
5353
ModelsRegularInvocable(&A::F, X);
5454
ModelsRegularInvocable(&A::G, X, 0);
5555
NotRegularInvocable(&A::G, X);
5656
NotRegularInvocable(&A::G, 0);
5757
NotRegularInvocable(&A::H);
5858

59-
auto const& Y = X;
59+
A const& Y = X;
6060
ModelsRegularInvocable(&A::I, Y);
6161
ModelsRegularInvocable(&A::F, Y);
6262
NotRegularInvocable(&A::G, Y, 0);

libcxx/test/std/concepts/comparison/types.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,22 @@ struct cxx20_friend_eq_operator_with_deleted_ne {
125125
struct member_three_way_comparable_with_deleted_eq {
126126
auto operator<=>(member_three_way_comparable_with_deleted_eq const&) const =
127127
default;
128-
auto
128+
bool
129129
operator==(member_three_way_comparable_with_deleted_eq const&) const = delete;
130130
};
131131

132132
struct member_three_way_comparable_with_deleted_ne {
133133
auto operator<=>(member_three_way_comparable_with_deleted_ne const&) const =
134134
default;
135-
auto
135+
bool
136136
operator!=(member_three_way_comparable_with_deleted_ne const&) const = delete;
137137
};
138138

139139
struct friend_three_way_comparable_with_deleted_eq {
140140
friend auto
141141
operator<=>(friend_three_way_comparable_with_deleted_eq const&,
142142
friend_three_way_comparable_with_deleted_eq const&) = default;
143-
friend auto
143+
friend bool
144144
operator==(friend_three_way_comparable_with_deleted_eq const&,
145145
friend_three_way_comparable_with_deleted_eq const&) = delete;
146146
};
@@ -149,7 +149,7 @@ struct friend_three_way_comparable_with_deleted_ne {
149149
friend auto
150150
operator<=>(friend_three_way_comparable_with_deleted_ne const&,
151151
friend_three_way_comparable_with_deleted_ne const&) = default;
152-
friend auto
152+
friend bool
153153
operator!=(friend_three_way_comparable_with_deleted_ne const&,
154154
friend_three_way_comparable_with_deleted_ne const&) = delete;
155155
};

libcxx/test/std/concepts/lang/assignable.compile.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ template <typename T1, typename T2>
125125
constexpr bool CheckAssignableFromRvalues() {
126126
NeverAssignableFrom<T1, T2>();
127127

128-
constexpr auto Result = std::assignable_from<T1&, T2>;
128+
constexpr bool Result = std::assignable_from<T1&, T2>;
129129
static_assert(std::assignable_from<T1&, T2&&> == Result);
130130

131131
return Result;
@@ -135,7 +135,7 @@ template <typename T1, typename T2>
135135
constexpr bool CheckAssignableFromLvalues() {
136136
NeverAssignableFrom<T1, T2>();
137137

138-
constexpr auto Result = std::assignable_from<T1&, const T2&>;
138+
constexpr bool Result = std::assignable_from<T1&, const T2&>;
139139
static_assert(std::assignable_from<T1&, T2&> == Result);
140140
static_assert(std::assignable_from<T1&, const T2&> == Result);
141141

@@ -543,8 +543,8 @@ static_assert(!CheckAssignableFromLvaluesAndRvalues<
543543

544544
static_assert(CheckAssignableFromLvaluesAndRvalues<std::vector<int>,
545545
std::vector<int> >());
546-
static_assert(!CheckAssignableFromLvaluesAndRvalues<std::vector<int>,
547-
std::vector<const int> >());
546+
static_assert(!CheckAssignableFromLvaluesAndRvalues<std::deque<int>,
547+
std::deque<const int> >());
548548
static_assert(!CheckAssignableFromLvaluesAndRvalues<
549549
std::vector<int>, std::vector<int, A1<int> > >());
550550
static_assert(!CheckAssignableFromLvaluesAndRvalues<std::vector<int>,

libcxx/test/std/concepts/lang/common.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
template <class T, class U>
1818
constexpr bool CheckCommonWith() noexcept {
19-
constexpr auto result = std::common_with<T, U>;
19+
constexpr bool result = std::common_with<T, U>;
2020
static_assert(std::common_with<T, U&> == result);
2121
static_assert(std::common_with<T, const U&> == result);
2222
static_assert(std::common_with<T, volatile U&> == result);

0 commit comments

Comments
 (0)