https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128413
--- Comment #1 from Jiang An <de34 at live dot cn> --- The following example is rejected with libstdc++ because iter_rvalue_reference_t <non_iter_movable_iterator> is ill-formed. https://godbolt.org/z/38aGdW56j According to the standard, the return type should be declared as `decltype(auto)` so ill-formed iter_rvalue_reference_t shouldn't cause hard error when instantiation common_iterator. ``` #include <iterator> template <class It> class non_iter_movable_iterator { It it_; public: using value_type = std::iter_value_t<It>; using difference_type = std::iter_difference_t<It>; friend constexpr It base(const non_iter_movable_iterator& i) { return i.it_; } explicit constexpr non_iter_movable_iterator(It it) : it_(it) {} constexpr decltype(auto) operator*() const { return *it_; } constexpr non_iter_movable_iterator& operator++() { ++it_; return *this; } constexpr void operator++(int) { ++it_; } friend constexpr void iter_move(const non_iter_movable_iterator&) {} }; int main() { int* p{}; non_iter_movable_iterator<int*> q{p}; std::common_iterator<non_iter_movable_iterator<int*>, std::unreachable_sentinel_t> it{q}; } ````
