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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to