[LLVMbugs] [Bug 14919] New: std::stoll and std::stoull don't throw std::out_of_range exception

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 11 00:17:34 PST 2013


             Bug #: 14919
           Summary: std::stoll and std::stoull don't throw
                    std::out_of_range exception
           Product: libc++
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
        AssignedTo: hhinnant at apple.com
        ReportedBy: imoldman.com at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider this code snippet. 
The expected output is |out_of_range|, but in fact it print

int main() {
    try {
        std::string s("99999999999999999999999999");
        auto result = std::stoll(s);
        std::cout << result << std::endl;
    } catch (const std::out_of_range&) {
        std::cout << "out_of_range" << std::endl;
    return 0;

os   :
  $ fgrep "string" /System/Library/CoreServices/SystemVersion.plist
    <string>1983-2012 Apple Inc.</string>
    <string>Mac OS X</string>

  $ clang -v
  Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  Target: x86_64-apple-darwin12.2.0
  Thread model: posix

  $ otool -L /usr/lib/libc++.dylib
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version
    /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list