Skip to content

Commit bbe8e35

Browse files
Test implicitness of basic_const_iterator's constructor
1 parent 1fd78c6 commit bbe8e35

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libcxx/test/std/iterators/const.iterators/iterator.pass.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <list>
1515
#include <memory>
1616
#include <ranges>
17+
#include <type_traits>
1718
#include <vector>
1819
#include "test_macros.h"
1920
#include "test_iterators.h"
@@ -169,6 +170,11 @@ int main() {
169170

170171
ASSERT_SAME_TYPE(std::iter_reference_t<ConstIt>, const int&);
171172
ASSERT_SAME_TYPE(std::iter_rvalue_reference_t<ConstIt>, const int&&);
173+
174+
static_assert(std::is_constructible_v<ConstIt, It>);
175+
static_assert(std::is_convertible_v<It, ConstIt>);
176+
static_assert(std::is_constructible_v<ConstIt, const It&> == std::is_copy_constructible_v<It>);
177+
static_assert(std::is_constructible_v<const It&, ConstIt> == std::is_copy_constructible_v<It>);
172178
});
173179

174180
test_p2836r1();

0 commit comments

Comments
 (0)