[Bug c++/11240] Weirdness with reverse_iterator<const char*>

paolo at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Oct 11 09:53:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From paolo at gcc dot gnu dot org  2003-10-11 09:53 -------
A further reduced testcase.

Paolo.

/////////////

#include <cassert> 

template<typename _Iterator>
  class reverse_iterator 
  {
  protected:
    _Iterator current;

  public:
    typedef _Iterator iterator_type;

    explicit 
    reverse_iterator(iterator_type __x)
    : current(__x)
    { }

    iterator_type 
    base() const { return current; }
  };

int main() 
{ 
  typedef reverse_iterator<const char*> RI;

  // char s[] = "0";
  const char s[] = "0";

  // RI r1(s);
  RI r1 = RI(s);

  const char* n1 = r1.base();
  assert( n1 == s );
}



More information about the Gcc-bugs mailing list