[Bug c++/11240] operator-() fails for reverse_iterator<const char*>

paolo at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Oct 11 09:14: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


paolo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu dot
                   |                            |org
          Component|libstdc++                   |c++


------- Additional Comments From paolo at gcc dot gnu dot org  2003-10-11 09:14 -------
Really seems a c++, not libstdc++ bug and I'm tentatively changing
its category.

Below a reduced testcase, with two workarounds in comments.

Nathan, could you possibly have a quick look?

Thanks in advance!
Paolo.

///////////

#include <iterator> 
#include <cassert> 

int main() 
{ 
  typedef std::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