[cfe-users] Failed formatted input using std::istream

David Blaikie dblaikie at gmail.com
Tue May 7 08:28:39 PDT 2013


Seems reasonable to me. Please file a bug at llvm.org/bugs
On May 7, 2013 7:38 AM, "Dmitri Shubin" <sbn at tbricks.com> wrote:

> 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!
> ______________________________**_________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/cfe-users<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130507/0ac98d67/attachment.html>


More information about the cfe-users mailing list