diff options
author | Christopher Di Bella <cjdb.ns@gmail.com> | 2021-03-04 22:07:45 -0800 |
---|---|---|
committer | Christopher Di Bella <cjdb.ns@gmail.com> | 2021-03-04 22:09:43 -0800 |
commit | 6eb5d55c55d176f9baf0c50d915ec4ec798c413b (patch) | |
tree | 7d0343d1c79f1063c92a9115846261d950742853 | |
parent | 063b19dea6991c2bc40bd93f262e20401792822d (diff) | |
download | llvm-6eb5d55c55d176f9baf0c50d915ec4ec798c413b.zip llvm-6eb5d55c55d176f9baf0c50d915ec4ec798c413b.tar.gz llvm-6eb5d55c55d176f9baf0c50d915ec4ec798c413b.tar.bz2 |
[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`
6 files changed, 21 insertions, 21 deletions
diff --git a/libcxx/include/concepts b/libcxx/include/concepts index 88a18e9..385ce09 100644 --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -243,6 +243,14 @@ template<class _Tp> concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>; +// [concept.copyconstructible] +template<class _Tp> +concept copy_constructible = + move_constructible<_Tp> && + constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> && + constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && + constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; + // [concept.booleantestable] template<class _Tp> concept __boolean_testable_impl = convertible_to<_Tp, bool>; @@ -275,14 +283,6 @@ concept equality_comparable_with = const remove_reference_t<_Up>&>> && __weakly_equality_comparable_with<_Tp, _Up>; -// [concept.copyconstructible] -template<class _Tp> -concept copy_constructible = - move_constructible<_Tp> && - constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> && - constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && - constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; - // [concept.invocable] template<class _Fn, class... _Args> concept invocable = requires(_Fn&& __fn, _Args&&... __args) { diff --git a/libcxx/test/std/concepts/callable/invocable.compile.pass.cpp b/libcxx/test/std/concepts/callable/invocable.compile.pass.cpp index 9afa9d9..cd415d8 100644 --- a/libcxx/test/std/concepts/callable/invocable.compile.pass.cpp +++ b/libcxx/test/std/concepts/callable/invocable.compile.pass.cpp @@ -49,7 +49,7 @@ int main(int, char**) { NotInvocable(&A::F); { - auto X = A{}; + A X; ModelsInvocable(&A::I, X); ModelsInvocable(&A::F, X); ModelsInvocable(&A::G, X, 0); @@ -57,7 +57,7 @@ int main(int, char**) { NotInvocable(&A::G, 0); NotInvocable(&A::H); - auto const& Y = X; + A const& Y = X; ModelsInvocable(&A::I, Y); ModelsInvocable(&A::F, Y); NotInvocable(&A::G, Y, 0); diff --git a/libcxx/test/std/concepts/callable/regularinvocable.compile.pass.cpp b/libcxx/test/std/concepts/callable/regularinvocable.compile.pass.cpp index f342ca5..b085b7e 100644 --- a/libcxx/test/std/concepts/callable/regularinvocable.compile.pass.cpp +++ b/libcxx/test/std/concepts/callable/regularinvocable.compile.pass.cpp @@ -48,7 +48,7 @@ int main(int, char**) { NotRegularInvocable(&A::F); { - auto X = A{}; + A X; ModelsRegularInvocable(&A::I, X); ModelsRegularInvocable(&A::F, X); ModelsRegularInvocable(&A::G, X, 0); @@ -56,7 +56,7 @@ int main(int, char**) { NotRegularInvocable(&A::G, 0); NotRegularInvocable(&A::H); - auto const& Y = X; + A const& Y = X; ModelsRegularInvocable(&A::I, Y); ModelsRegularInvocable(&A::F, Y); NotRegularInvocable(&A::G, Y, 0); diff --git a/libcxx/test/std/concepts/comparison/types.h b/libcxx/test/std/concepts/comparison/types.h index 2813053..6f7689e 100644 --- a/libcxx/test/std/concepts/comparison/types.h +++ b/libcxx/test/std/concepts/comparison/types.h @@ -125,14 +125,14 @@ struct cxx20_friend_eq_operator_with_deleted_ne { struct member_three_way_comparable_with_deleted_eq { auto operator<=>(member_three_way_comparable_with_deleted_eq const&) const = default; - auto + bool operator==(member_three_way_comparable_with_deleted_eq const&) const = delete; }; struct member_three_way_comparable_with_deleted_ne { auto operator<=>(member_three_way_comparable_with_deleted_ne const&) const = default; - auto + bool operator!=(member_three_way_comparable_with_deleted_ne const&) const = delete; }; @@ -140,7 +140,7 @@ struct friend_three_way_comparable_with_deleted_eq { friend auto operator<=>(friend_three_way_comparable_with_deleted_eq const&, friend_three_way_comparable_with_deleted_eq const&) = default; - friend auto + friend bool operator==(friend_three_way_comparable_with_deleted_eq const&, friend_three_way_comparable_with_deleted_eq const&) = delete; }; @@ -149,7 +149,7 @@ struct friend_three_way_comparable_with_deleted_ne { friend auto operator<=>(friend_three_way_comparable_with_deleted_ne const&, friend_three_way_comparable_with_deleted_ne const&) = default; - friend auto + friend bool operator!=(friend_three_way_comparable_with_deleted_ne const&, friend_three_way_comparable_with_deleted_ne const&) = delete; }; diff --git a/libcxx/test/std/concepts/lang/assignable.compile.pass.cpp b/libcxx/test/std/concepts/lang/assignable.compile.pass.cpp index 450c0bc..1278f84 100644 --- a/libcxx/test/std/concepts/lang/assignable.compile.pass.cpp +++ b/libcxx/test/std/concepts/lang/assignable.compile.pass.cpp @@ -125,7 +125,7 @@ template <typename T1, typename T2> constexpr bool CheckAssignableFromRvalues() { NeverAssignableFrom<T1, T2>(); - constexpr auto Result = std::assignable_from<T1&, T2>; + constexpr bool Result = std::assignable_from<T1&, T2>; static_assert(std::assignable_from<T1&, T2&&> == Result); return Result; @@ -135,7 +135,7 @@ template <typename T1, typename T2> constexpr bool CheckAssignableFromLvalues() { NeverAssignableFrom<T1, T2>(); - constexpr auto Result = std::assignable_from<T1&, const T2&>; + constexpr bool Result = std::assignable_from<T1&, const T2&>; static_assert(std::assignable_from<T1&, T2&> == Result); static_assert(std::assignable_from<T1&, const T2&> == Result); @@ -543,8 +543,8 @@ static_assert(!CheckAssignableFromLvaluesAndRvalues< static_assert(CheckAssignableFromLvaluesAndRvalues<std::vector<int>, std::vector<int> >()); -static_assert(!CheckAssignableFromLvaluesAndRvalues<std::vector<int>, - std::vector<const int> >()); +static_assert(!CheckAssignableFromLvaluesAndRvalues<std::deque<int>, + std::deque<const int> >()); static_assert(!CheckAssignableFromLvaluesAndRvalues< std::vector<int>, std::vector<int, A1<int> > >()); static_assert(!CheckAssignableFromLvaluesAndRvalues<std::vector<int>, diff --git a/libcxx/test/std/concepts/lang/common.compile.pass.cpp b/libcxx/test/std/concepts/lang/common.compile.pass.cpp index 6db6b57..d66d00d 100644 --- a/libcxx/test/std/concepts/lang/common.compile.pass.cpp +++ b/libcxx/test/std/concepts/lang/common.compile.pass.cpp @@ -16,7 +16,7 @@ template <class T, class U> constexpr bool CheckCommonWith() noexcept { - constexpr auto result = std::common_with<T, U>; + constexpr bool result = std::common_with<T, U>; static_assert(std::common_with<T, U&> == result); static_assert(std::common_with<T, const U&> == result); static_assert(std::common_with<T, volatile U&> == result); |