This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++/2627: istreambuf_iterator fails to satisfy input iterator requirements



>Number:         2627
>Category:       libstdc++
>Synopsis:       istreambuf_iterator fails to satisfy input iterator requirements
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 24 11:36:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     John Wilkinson
>Release:        3.0 20010416 (prerelease)
>Organization:
AT&T Research
>Environment:
System: Linux mp-dhcp-4-40.attlabs.att.com 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure 
>Description:
  An istreambuf_iterator should satisfy the requirements of an input iterator.
  In particular, x++ and ++x should be equivalent if the return value is not
  used.  But the test program shows this not to be the case.  the output should
  be
    a
    b
    c
  Instead it is
    a
    a
    b
  It appears to be the postfix form that is in error.

  Here's the program.  Since this is a library problem, I assume I shouldn't
  bother with post-included source.

#include <iostream>
#include <iterator>
#include <sstream>

int main()
{
  std::string s("abcde");
  std::istringstream in(s);
  std::istreambuf_iterator<char> i(in);
  std::cout << *i << std::endl;
  ++i;
  std::cout << *i << std::endl;
  i++;
  std::cout << *i << std::endl;
}

  Replacing the line 'i++;' by '++i' results in the expected output.

>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:
 END-PR: doc-bug          The doumentation is incorrect.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]