[libcxx-commits] [libcxx] cfe1798 - [libcxx][test] {move, reverse}_iterator cannot be instantiated for a type with no `operator*`
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 24 08:34:44 PST 2022
Author: Casey Carter
Date: 2022-01-24T08:34:39-08:00
New Revision: cfe17986c952e552a731237da99f4879def3a02b
URL: https://github.com/llvm/llvm-project/commit/cfe17986c952e552a731237da99f4879def3a02b
DIFF: https://github.com/llvm/llvm-project/commit/cfe17986c952e552a731237da99f4879def3a02b.diff
LOG: [libcxx][test] {move,reverse}_iterator cannot be instantiated for a type with no `operator*`
Since their nested reference types are defined in terms of `iter_reference_t<T>`, which examines `decltype(*declval<T>())`.
Differential Revision: https://reviews.llvm.org/D117371
Added:
Modified:
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
Removed:
################################################################################
diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
index 42a28cf14cfd0..d4857d7b0082b 100644
--- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op=/move_iterator.pass.cpp
@@ -42,7 +42,7 @@ struct ToIter {
typedef char *pointer;
typedef char &reference;
typedef char value_type;
- typedef value_type
diff erence_type;
+ typedef signed char
diff erence_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 @@ struct ToIter {
return *this;
}
char *m_value;
+
+ reference operator*() const;
};
TEST_CONSTEXPR_CXX17 bool test_conv_assign()
diff --git a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
index e8379e24cffae..a48a7ea924c52 100644
--- a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cmp/three-way.pass.cpp
@@ -42,6 +42,8 @@ struct Iter {
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 @@ struct ConstIter {
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;
diff --git a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
index c3dbfa9a41b66..0e5123a49e2b5 100644
--- a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
+++ b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.cons/assign.pass.cpp
@@ -51,6 +51,8 @@ struct ToIter {
return *this;
}
char *m_value;
+
+ reference operator*() const;
};
TEST_CONSTEXPR_CXX17 bool tests() {
More information about the libcxx-commits
mailing list