Failed formatted input using std::istream

Hello!

For the following small test I got different result when using clang w/ libstdc++ and libc++:

#include <sstream>
#include <iostream>

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

$ clang++ a.cpp
$ ./a.out
12345
$ 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

If my understanding of the C++ standard (C++03) is correct libstdc++ is right here, since 22.2.2.1.2p1 [lib.facet.num.get.virtuals] says
"If an error occurs, val is unchanged; otherwise it is set to the resulting value."

Or am I missing something and I shouldn't count on particular result here?

Thanks!

Seems reasonable to me. Please file a bug at llvm.org/bugs

Filed Explanation from Howard Hinnant (): BTW, file the same case against latest libstdc++ –