| 1 | // { dg-do compile { target c++20 } } |
| 2 | |
| 3 | #include <iterator> |
| 4 | |
| 5 | struct InputIterator |
| 6 | { |
| 7 | using difference_type = int; |
| 8 | using value_type = int; |
| 9 | |
| 10 | constexpr int operator*() const noexcept { return 0; } |
| 11 | InputIterator& operator++() { return *this; } |
| 12 | constexpr void operator++(int) { } |
| 13 | }; |
| 14 | |
| 15 | static_assert( std::input_iterator<InputIterator> ); |
| 16 | static_assert( !std::forward_iterator<InputIterator> ); |
| 17 | |
| 18 | constexpr bool |
| 19 | test_lwg3643() |
| 20 | { |
| 21 | std::counted_iterator<InputIterator> iter({}, 1); |
| 22 | iter++; |
| 23 | return iter == std::default_sentinel; |
| 24 | } |
| 25 | |
| 26 | static_assert( test_lwg3643() ); |