// { dg-do compile { target c++11 } } #include template struct bidi { using value_type = T; using pointer = T*; using reference = T&; using difference_type = std::ptrdiff_t; using iterator_category = std::bidirectional_iterator_tag; T* ptr; bidi(T* ptr = nullptr) noexcept(Nothrow) : ptr(ptr) { } bidi(const bidi& iter) noexcept(Nothrow) : ptr(iter.ptr) { } template bidi(const bidi& iter) noexcept(Nothrow) : ptr(iter.ptr) { } bidi& operator=(const bidi& iter) noexcept(Nothrow) { ptr = iter.ptr; return *this; } template bidi& operator=(const bidi& iter) noexcept(Nothrow) { ptr = iter.ptr; return *this; } bidi& operator++() { ++ptr; return *this; } bidi& operator--() { --ptr; return *this; } bidi operator++(int) { bidi tmp = *this; ++ptr; return tmp; } bidi operator--(int) { bidi tmp = *this; --ptr; return tmp; } reference operator*() const { return *ptr; } pointer operator->() const { return ptr; } }; void test01() { using B1 = bidi; using R1 = std::reverse_iterator; static_assert( std::is_nothrow_default_constructible(), "" ); static_assert( std::is_nothrow_copy_constructible(), "" ); static_assert( std::is_nothrow_move_constructible(), "" ); static_assert( std::is_nothrow_copy_assignable(), "" ); static_assert( std::is_nothrow_move_assignable(), "" ); static_assert( std::is_nothrow_constructible(), "" ); static_assert( std::is_nothrow_constructible(), "" ); using B2 = bidi; using R2 = std::reverse_iterator; // Test conversions from reverse_iterator to reverse_iterator. static_assert( std::is_nothrow_constructible(), "" ); static_assert( std::is_nothrow_assignable(), "" ); // And from B1 to reverse_iterator. static_assert( std::is_nothrow_constructible(), "" ); static_assert( std::is_nothrow_constructible(), "" ); static_assert( std::is_nothrow_constructible(), "" ); static_assert( std::is_nothrow_constructible(), "" ); using B3 = bidi; using R3 = std::reverse_iterator; static_assert( ! std::is_nothrow_default_constructible(), "" ); static_assert( ! std::is_nothrow_copy_constructible(), "" ); static_assert( ! std::is_nothrow_move_constructible(), "" ); static_assert( ! std::is_nothrow_copy_assignable(), "" ); static_assert( ! std::is_nothrow_move_assignable(), "" ); static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( ! std::is_nothrow_constructible(), "" ); using B4 = bidi; using R4 = std::reverse_iterator; // Test conversions from reverse_iterator to reverse_iterator. static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( ! std::is_nothrow_assignable(), "" ); // And from B3 to reverse_iterator. static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( ! std::is_nothrow_constructible(), "" ); static_assert( noexcept(std::declval().base()), "" ); static_assert( ! noexcept(std::declval().base()), "" ); }