[libcxx-commits] [libcxx] 1716c36 - [libc++] [test] More test coverage for ranges::{data, size}.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 4 14:17:52 PST 2022
Author: Arthur O'Dwyer
Date: 2022-01-04T17:15:26-05:00
New Revision: 1716c36d84030358a025558d16e6d484b40c14cc
URL: https://github.com/llvm/llvm-project/commit/1716c36d84030358a025558d16e6d484b40c14cc
DIFF: https://github.com/llvm/llvm-project/commit/1716c36d84030358a025558d16e6d484b40c14cc.diff
LOG: [libc++] [test] More test coverage for ranges::{data,size}.
Reviewed as part of D116239.
Added:
Modified:
libcxx/test/std/ranges/range.access/data.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/ranges/range.access/data.pass.cpp b/libcxx/test/std/ranges/range.access/data.pass.cpp
index 4e03dc4d8bd7..40d2d3ab8eca 100644
--- a/libcxx/test/std/ranges/range.access/data.pass.cpp
+++ b/libcxx/test/std/ranges/range.access/data.pass.cpp
@@ -15,6 +15,7 @@
#include <ranges>
#include <cassert>
+#include <type_traits>
#include "test_macros.h"
#include "test_iterators.h"
@@ -116,9 +117,10 @@ struct BeginMemberRandomAccess {
random_access_iterator<const int*> begin() const;
};
-static_assert(!std::is_invocable_v<RangeDataT, BeginMemberRandomAccess>);
-static_assert(!std::is_invocable_v<RangeDataT, BeginMemberRandomAccess const>);
-static_assert(!std::is_invocable_v<RangeDataT, BeginMemberRandomAccess const&>);
+static_assert(!std::is_invocable_v<RangeDataT, BeginMemberRandomAccess&>);
+static_assert(!std::is_invocable_v<RangeDataT, BeginMemberRandomAccess&&>);
+static_assert(!std::is_invocable_v<RangeDataT, const BeginMemberRandomAccess&>);
+static_assert(!std::is_invocable_v<RangeDataT, const BeginMemberRandomAccess&&>);
struct BeginFriendContiguousIterator {
int buff[8];
@@ -135,9 +137,10 @@ static_assert(!std::is_invocable_v<RangeDataT, BeginMemberContiguousIterator con
struct BeginFriendRandomAccess {
friend random_access_iterator<const int*> begin(const BeginFriendRandomAccess iter);
};
-static_assert(!std::is_invocable_v<RangeDataT, BeginFriendRandomAccess>);
-static_assert(!std::is_invocable_v<RangeDataT, BeginFriendRandomAccess const>);
-static_assert(!std::is_invocable_v<RangeDataT, BeginFriendRandomAccess const&>);
+static_assert(!std::is_invocable_v<RangeDataT, BeginFriendRandomAccess&>);
+static_assert(!std::is_invocable_v<RangeDataT, BeginFriendRandomAccess&&>);
+static_assert(!std::is_invocable_v<RangeDataT, const BeginFriendRandomAccess&>);
+static_assert(!std::is_invocable_v<RangeDataT, const BeginFriendRandomAccess&&>);
struct BeginMemberRvalue {
int buff[8];
@@ -173,6 +176,12 @@ constexpr bool testViaRangesBegin() {
return true;
}
+struct RandomButNotContiguous {
+ random_access_iterator<int*> begin() const;
+ random_access_iterator<int*> end() const;
+};
+static_assert(!std::is_invocable_v<RangeDataT, RandomButNotContiguous>);
+
int main(int, char**) {
testDataMember();
static_assert(testDataMember());
More information about the libcxx-commits
mailing list