[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


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

             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
|9223372036854775807|.

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>12C60</string>
    <string>1983-2012 Apple Inc.</string>
    <string>Mac OS X</string>
    <string>10.8.2</string>
    <string>10.8.2</string>

clang: 
  $ 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

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

-- 
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