boostorg / date_time

Boost.org date_time module
http://boost.org/libs/date_time
Boost Software License 1.0
67 stars 95 forks source link

Conversion warnings C4244 in date_parsing.hpp when compiling 1.73 release candidate with VS2017 #148

Closed thebrandre closed 4 years ago

thebrandre commented 4 years ago

Visual Studio 2017's compiler generates multiple conversion warnings from int literals to unsigned short in the implementation of this function

inline unsigned short
    month_str_to_ushort(std::string const& s) 

warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data boost_fc31e493\boost\date_time\date_parsing.hpp(99): note: see reference to function template instantiation 'std::pair<const _Kty,_Ty>::pair<const char(&)[4],int,0>(_Other1,_Other2 &&) noexcept(false)' being compiled [...]

One might just use explicit cast as in the BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX case to resolve that.

JeffGarland commented 4 years ago

Sorry -- what compile options?

thebrandre commented 4 years ago

Compiled with warning level /W4. Here's a simplified example on godbolt. gcc and clang don't complain with -Wall enabled.

JeffGarland commented 4 years ago

yep - ok thanks, I'll work on it.

JeffGarland commented 4 years ago

Fixed in boost 1.74