[LLVMbugs] [Bug 22372] New: istream fails to parse a number followed by "x"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 28 11:58:43 PST 2015


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

            Bug ID: 22372
           Summary: istream fails to parse a number followed by "x"
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alessandro at pintle.it
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

I apologize if this was already reported or fixed; I couldn't find any matching
bug report. I also apologize if this is not a bug and it's expected/undefined
behavior.

This can be reproduced using the libc++ version that is carried with MacOS X
Yosemite.

#include <stdio.h>
#include <limits>
#include <iostream>
#include <sstream>

int main( ) {
  double x = 0;
  double y = 0;
  std::string point_str("4x5");
  std::istringstream iss(point_str);

  // Prints "0,0" on Yosemite, "4,5" on other platforms
  iss >> x;
  iss.ignore(std::numeric_limits<std::streamsize>::max(), 'x');
  iss >> y;
  std::cout << x << "," << y << std::endl;
}

-- 
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/20150128/ca47ce0b/attachment.html>


More information about the llvm-bugs mailing list