[libcxx-commits] [PATCH] D117371: [libcxx][test] {move, reverse}_iterator cannot be instantiated for a type with no `operator*` in C++20
Casey Carter via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 14 16:55:39 PST 2022
CaseyCarter created this revision.
CaseyCarter added a reviewer: libc++.
CaseyCarter added a project: libc++.
CaseyCarter requested review of this revision.
Herald added 1 blocking reviewer(s): libc++.
Since their nested `reference` types are defined in terms of `iter_reference_t<T>`, which examines `decltype(*declval<T>())`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117371
Files:
libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
Index: libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
===================================================================
--- libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
+++ libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
@@ -51,6 +51,8 @@
return *this;
}
char *m_value;
+
+ reference operator*() const;
};
TEST_CONSTEXPR_CXX17 bool tests() {
Index: libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
===================================================================
--- libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
+++ libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
@@ -42,6 +42,8 @@
constexpr Iter(double value): m_value(value) {}
double m_value;
+
+ reference operator*() const;
private:
friend constexpr bool operator==(const Iter& l, const Iter& r) = default;
friend constexpr std::partial_ordering operator<=>(const Iter& l, const Iter& r) = default;
@@ -57,6 +59,8 @@
constexpr ConstIter(double value): m_value(value) {}
constexpr ConstIter(Iter it): m_value(it.m_value) {}
double m_value;
+
+ reference operator*() const;
private:
friend constexpr bool operator==(const ConstIter& l, const ConstIter& r) = default;
friend constexpr std::partial_ordering operator<=>(const ConstIter& l, const ConstIter& r) = default;
Index: libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
===================================================================
--- libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
+++ libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
@@ -42,7 +42,7 @@
typedef char *pointer;
typedef char &reference;
typedef char value_type;
- typedef value_type difference_type;
+ typedef signed char difference_type;
explicit TEST_CONSTEXPR_CXX17 ToIter() : m_value(0) {}
TEST_CONSTEXPR_CXX17 ToIter(const ToIter &src) : m_value(src.m_value) {}
@@ -57,6 +57,8 @@
return *this;
}
char *m_value;
+
+ reference operator*() const;
};
TEST_CONSTEXPR_CXX17 bool test_conv_assign()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117371.400197.patch
Type: text/x-patch
Size: 2497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220115/cfb92a5f/attachment.bin>
More information about the libcxx-commits
mailing list