Rope iterators (both const and mutable) do not meet the requirements of an
Input Iterator, because their dereference operator only operates on non-const
objects. Table 72 of the C++98 Standard requires the valid expression *a, where
a is a const iterator, but this valid expression does not work with a non-const
operator*.

To fix, make operator* and everything it relies on "const". This might have an
unfortunate ripple effect; an alternative (but ugly) approach would be to add a
new operator* to _Rope_iterator and _Rope_const_iterator that const_cast's and
forwards:

  reference
  operator*() const
  {
    return *const_cast<_Rope_iterator&>(*this);
  }

  reference
  operator*() const
  {
    return *const_cast<_Rope_const_iterator&>(*this);
  }

This problem is very unlikely to cause problems in user code, but it makes
ConceptGCC sad.


-- 
           Summary: Rope iterators are not InputIterators
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doug dot gregor at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27404

Reply via email to