When the values is guaranteed to fit in the SSO buffer we know the string won't allocate, so the function can be noexcept. For 32-bit integers, we know they need no more than 9 bytes (or 10 with a minus sign) and the SSO buffer is 15 bytes. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI] (to_string): Add noexcept if the type width is 32 bits or less. Tested x86_64-linux. Committed to trunk.