Skip to content

convertFromString<double>() does not restore the old locale properly #250

Closed
@unvestigate

Description

@unvestigate

I have found that convertFromString() in basic_types.cpp sometimes sets an incorrect locale after converting the string to a double. The old_locale string starts out getting the value "C", which in my case is correct. However, after the next call to setlocale(), which sets it to "C" (ie. the same locale) the old_locale string is garbage.

Changing old_locale to "std::string" instead of "const auto", ie. making a local copy, fixes the error. This is tested on windows with both MSVC 2015 and 2019.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions