[LLVMbugs] [Bug 15934] New: failed formatted input overwrites output value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 8 04:40:18 PDT 2013


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

            Bug ID: 15934
           Summary: failed formatted input overwrites output value
           Product: libc++
           Version: 3.2
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: sbn at tbricks.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hello!

Here is a small test:

#include <sstream>
#include <iostream>

int main()
{
    std::istringstream iss("-a");
    unsigned i = 12345;
    iss >> i;
    std::cout << i << std::endl;
    return 0;
}

When building with clang/libc++ I got the following output:

$ clang++ -stdlib=libc++ a.cpp
$ ./a.out
0
$ clang -v
Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
$ uname -a
Darwin hostname 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST
2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64

In C++ standard (C++03) I can see 22.2.2.1.2p1 [lib.facet.num.get.virtuals]:
"If an error occurs, val is unchanged; otherwise it is set to the resulting
value."

-- 
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/20130508/0492d2ad/attachment.html>


More information about the llvm-bugs mailing list