[llvm-bugs] [Bug 47849] New: num_get::do_get(in, end, unsigned) broken for negative numbers
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 14 21:49:47 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47849
Bug ID: 47849
Summary: num_get::do_get(in, end, unsigned) broken for negative
numbers
Product: libc++
Version: 11.0
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: ramey at rrsd.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
#include <iostream>
#include <sstream>
int main()
try {
unsigned u;
std::istringstream is{"-1"};
is >> u;
std::cout << u << std::endl;
}
catch (std::exception const& e)
{
std::cerr << "ERR: " << e.what() << std::endl;
}
reading a character stream containing "-1" into an unsigned integer does not
set the fail bit nor does it throw an exception. After the read completes, the
unsigned integer has a huge number in it.
--
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/20201015/841de6d3/attachment.html>
More information about the llvm-bugs
mailing list