Fix valgrind warning about uninitialized variable use in to_stream()

tm variable is not initialized in to_stream(), and valgrind warns about
"Conditional jump or move depends on uninitialised value(s)".

This is a false positive, as strftime always reads tm_hour, even if it
ends up never using it. To silence the warnings, initialize tm to zero.
This commit is contained in:
Tomi Valkeinen 2017-10-03 21:22:16 +03:00 committed by Howard Hinnant
parent 2e213abb76
commit 2032fccbb7

View File

@ -4566,7 +4566,7 @@ to_stream(std::basic_ostream<CharT, Traits>& os, const CharT* fmt,
{
using namespace std;
using namespace std::chrono;
tm tm;
tm tm{};
#if !ONLY_C_LOCALE
auto& facet = use_facet<time_put<CharT>>(os.getloc());
#endif