Please CC libstdc++ patches to the libstdc++ list, or they won't get reviewed (because I don't subscribe to gcc-patches).
GCC 5 does implement SSO but it's only used conditionally. Your patch uses numeric_limits unconditionally, which will result in over-allocation for COW strings. There also seems to be a syntax error in the unsigned overload, was this patch tested? Minor: the "component" tag in the subject should be just "libstdc++:" without the "-v3" part.