[LLVMbugs] [Bug 15445] New: istream fails to parse long numeric string correctly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 5 04:03:52 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=15445

            Bug ID: 15445
           Summary: istream fails to parse long numeric string correctly
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: All Bugs
          Assignee: hhinnant at apple.com
          Reporter: john at johnmaddock.co.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code fails as reading stops on the '+' character (but that's not
the bug, removing the '+' from the string still causes it to fail).

#include <sstream>
#include <cassert>

int main(int argc, char** argv)
{
   std::stringstream ss;
   ss <<
"3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651e+10";
   long double d;
   ss >> d;
   //char c = ss.get();
   assert(ss.rdbuf()->in_avail() == 0);
   return 0;
}

The rational for wanting to do this, is that we have both numeric constants and
test data expressed as a string - sometimes this is read into a multiprecision
type, and sometimes into a native type.

The failure is with SVN Trunk BTW.

-- 
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/20130305/45e367a3/attachment.html>


More information about the llvm-bugs mailing list