<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - failed formatted input overwrites output value"
href="http://llvm.org/bugs/show_bug.cgi?id=15934">15934</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>failed formatted input overwrites output value
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>sbn@tbricks.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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."</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>