<chrono>: Use designated aggregate initialization when returning tm by frederick-vs-ja · Pull Request #5662 · microsoft/STL (original) (raw)

There's only one place in the whole MSVC STL where tm is returned by value. Currently, the tm_isdst member of the variable to return is uninitialized, so it can be sometimes technically UB/EB to return such an object, unless NRVO is done.

I think it's arguably better and clearer to just return a prvalue using designated aggregate initialization, which zero-initializes the tm_isdst member without mentioning it. Note that currently it's only mentioned in a comment among the whole STL.

Edit: Clang doesn't like such implicit zero-initialization. Sigh.