https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70493

            Bug ID: 70493
           Summary: std::setlocale("") throws exception
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michi at triodia dot com
  Target Milestone: ---

#include <locale>

int main(int, char**)
{
    std::locale("");
}

Compile with --std=c++11 and run with

$ LC_ALL= LC_MONETARY=bad ./a.out

This aborts with a std::runtime_error: locale::facet::_S_create_c_locale name
not valid

From the C++ 11 spec, 22.3.1.2/8:

"Remarks: The set of valid string argument values is "C", "", and any
implementation-defined values."

By definition, "C" and "" are valid arguments, so I don't think this is allowed
to throw?

Reply via email to