For the --enable-clocale=generic configuration, the current code can fail with a bad_alloc exception. This patch uses the nothrow version of operator new and reports allocation failures by setting failbit in the iostate variable. * config/locale/generic/c_locale.cc (__set_C_locale()): New function to set the "C" locale and return the name of the previous locale. (__convert_to_v, __convert_to_v) (__convert_to_v): Use __set_C_locale and set failbit on error. Tested sparc-sun-solaris2.11. Committed to trunk.