[llvm-bugs] [Bug 25053] New: outback does not clear eofbit

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 5 05:52:30 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25053

            Bug ID: 25053
           Summary: outback does not clear eofbit
           Product: libc++
           Version: 3.7
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: akim.demaille at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Hi!

It is my understanding than in C++11, contrary to C++98, the following program
has a well defined behavior, and I should get what I have put back in the
stream:

$ cat /tmp/foo.cc
#include <iostream>
#include <sstream>
#include <string>

int main()
{
  std::istringstream i{"a"};
  int c = i.get();
  std::cerr << c << '\n';
  i.peek();
  i.putback('A');
  c = i.peek();
  std::cerr << c << '\n';
}
$ clang++-mp-3.7 -std=c++14 /tmp/foo.cc
$ ./a.out
97
-1
$ clang++-mp-3.3 -std=c++11 /tmp/foo.cc
$ ./a.out
97
-1


Please, note that if I use unget instead of putback, I get the expected
behavior.

Cheers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151005/81952123/attachment.html>


More information about the llvm-bugs mailing list