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

            Bug ID: 17782
           Summary: num_get::do_get(in, end, double) broken if double is
                    followed by character
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 11475
  --> http://llvm.org/bugs/attachment.cgi?id=11475&action=edit
Test program documenting the problem.

When extracting doubles from stringstream the character following the double
affects if extraction works or not (see attached code example). If the double
is followed by a space or underscore extraction works, if a letter follows
extraction fails. It seems to be related to the extraction of the double
performed by num_get::do_get().

If I read the standard correctly (ISO/IEC 14882:2003(E), 22.2.2.1.2 num_get
virtual functions [lib.facet.num.get.virtuals]; sorry no 2011 at hand) this
should work independently of the character following the double.

Tested with:

$ c++ --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Steps to reproduce:

1. Compile the attached test program (c++ --stdlib=libc++ streamtest.cxx)
2. Run the attached test program

Actual result:

'-4.9' converted to -4.9
'-4.9 X' converted to -4.9
'-4.9_' converted to -4.9
'-4.9d' failed to convert to double
'-4.9X' failed to convert to double

Expected result: (produced with c++ --stdlib=libstdc++ streamtest.cxx)

'-4.9' converted to -4.9
'-4.9 X' converted to -4.9
'-4.9_' converted to -4.9
'-4.9d' converted to -4.9
'-4.9X' converted to -4.9

Build Date & Platform: 2013-11-01 on Mac OS 10.9

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to