[LLVMbugs] [Bug 19354] New: failed stream extraction consumes characters after clear (libstdc++ vs libc++)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 7 07:23:50 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19354

            Bug ID: 19354
           Summary: failed stream extraction consumes characters after
                    clear (libstdc++ vs libc++)
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gellule.xg at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

Thought I would report the following difference between libstdc++ and libc++.
For the code below, libc++ reports a position (ss.tellg()) of 3, whereas
libstdc++ reports 0.


#include <iostream>
#include <sstream>

int main()
{
    std::stringstream ss;
    double f;
    ss << "abc";
    ss >> f;
    if(ss.fail()) {
        std::cout << "Failed!" << std::endl;
        ss.clear();
    }
    std::cout << "Position: " << ss.tellg() << std::endl;
}

-- 
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/20140407/452a204d/attachment.html>


More information about the llvm-bugs mailing list