Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
unvestigate opened this issue Jan 13, 2021 · 1 comment
Closed

Comments

@unvestigate
Copy link
Contributor

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.

@facontidavide
Copy link
Collaborator

fixed. thanks a lot

facontidavide added a commit that referenced this issue Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants