id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 7687,[date_time] implicit conversion loses integer precision,crueegg@…,az_sw_dude,"Compiling with Apple/clang-421.11.66, including boost/date_time.hpp, gives multiple warnings about implicite long64 to int32 conversions: main.cpp:9 {{{ #include }}} {{{ clang -x c++ -stdlib=libstdc++ -Iboost_1_52_0 -Wshorten-64-to-32 -c main.cpp In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:24: In file included from boost_1_52_0/boost/date_time/posix_time/time_formatters.hpp:16: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_types.hpp:16: boost_1_52_0/boost/date_time/posix_time/posix_time_duration.hpp:24:21: warning: implicit conversion loses integer precision: 'long' to 'hour_type' (aka 'int') [-Wshorten-64-to-32] time_duration(h,0,0) ~~~~~~~~~~~~~ ^ boost_1_52_0/boost/date_time/posix_time/posix_time_duration.hpp:35:23: warning: implicit conversion loses integer precision: 'long' to 'min_type' (aka 'int') [-Wshorten-64-to-32] time_duration(0,m,0) ~~~~~~~~~~~~~ ^ boost_1_52_0/boost/date_time/posix_time/posix_time_duration.hpp:46:25: warning: implicit conversion loses integer precision: 'long' to 'sec_type' (aka 'int') [-Wshorten-64-to-32] time_duration(0,0,s) ~~~~~~~~~~~~~ ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:18: In file included from boost_1_52_0/boost/date_time/gregorian/gregorian_types.hpp:19: In file included from boost_1_52_0/boost/date_time/gregorian/greg_calendar.hpp:15: In file included from boost_1_52_0/boost/date_time/gregorian_calendar.hpp:63: boost_1_52_0/boost/date_time/gregorian_calendar.ipp:82:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'date_int_type' (aka 'unsigned int') [-Wshorten-64-to-32] return d; ~~~~~~ ^ boost_1_52_0/boost/date_time/date.hpp:71:25: note: in instantiation of member function 'boost::date_time::gregorian_calendar_base, unsigned int>::day_number' requested here : days_(calendar::day_number(ymd_type(y, m, d))) ^ boost_1_52_0/boost/date_time/gregorian/greg_date.hpp:56:9: note: in instantiation of member function 'boost::date_time::date::date' requested here : date_time::date(y, m, d) ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:18: In file included from boost_1_52_0/boost/date_time/gregorian/gregorian_types.hpp:19: In file included from boost_1_52_0/boost/date_time/gregorian/greg_calendar.hpp:15: In file included from boost_1_52_0/boost/date_time/gregorian_calendar.hpp:63: boost_1_52_0/boost/date_time/gregorian_calendar.ipp:47:14: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] return week; ~~~~~~ ^~~~ boost_1_52_0/boost/date_time/gregorian/greg_date.hpp:111:34: note: in instantiation of member function 'boost::date_time::gregorian_calendar_base, unsigned int>::week_number' requested here return gregorian_calendar::week_number(ymd); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:18: In file included from boost_1_52_0/boost/date_time/gregorian/gregorian_types.hpp:19: In file included from boost_1_52_0/boost/date_time/gregorian/greg_calendar.hpp:15: In file included from boost_1_52_0/boost/date_time/gregorian_calendar.hpp:63: boost_1_52_0/boost/date_time/gregorian_calendar.ipp:52:16: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] return week; //under these circumstances week == 53. ~~~~~~ ^~~~ boost_1_52_0/boost/date_time/gregorian_calendar.ipp:63:14: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] return week; ~~~~~~ ^~~~ boost_1_52_0/boost/date_time/gregorian_calendar.ipp:66:12: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] return week; //not reachable -- well except if day == 5 and is_leap_year != true ~~~~~~ ^~~~ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:15: boost_1_52_0/boost/date_time/time_system_counted.hpp:57:52: warning: implicit conversion loses integer precision: 'unsigned long' to 'typename calendar_type::date_int_type' (aka 'unsigned int') [-Wshorten-64-to-32] typename calendar_type::date_int_type dc = day_count(); ~~ ^~~~~~~~~~~ boost_1_52_0/boost/date_time/time_system_counted.hpp:170:18: note: in instantiation of member function 'boost::date_time::counted_time_rep::date' requested here return val.date(); ^ boost_1_52_0/boost/date_time/time.hpp:72:27: note: in instantiation of member function 'boost::date_time::counted_time_system >::get_date' requested here return time_system::get_date(time_); ^ boost_1_52_0/boost/date_time/posix_time/date_duration_operators.hpp:33:31: note: in instantiation of member function 'boost::date_time::base_time> >::date' requested here return t + m.get_offset(t.date()); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:18: In file included from boost_1_52_0/boost/date_time/gregorian/gregorian_types.hpp:17: boost_1_52_0/boost/date_time/date.hpp:180:47: warning: implicit conversion loses integer precision: 'duration_rep_type' (aka 'long') to 'int_type' (aka 'unsigned int') [-Wshorten-64-to-32] return date_type(date_rep_type(days_) + dd.days()); ~~~~~~~~~~~~~ ^~~~~~~~~ boost_1_52_0/boost/date_time/time.hpp:145:49: note: in instantiation of member function 'boost::date_time::date::operator+' requested here time_ = (time_system::get_time_rep(date() + dd, time_of_day())); ^ boost_1_52_0/boost/date_time/posix_time/date_duration_operators.hpp:44:14: note: in instantiation of member function 'boost::date_time::base_time> >::operator+=' requested here return t += m.get_offset(t.date()); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:17: In file included from boost_1_52_0/boost/date_time/time_resolution_traits.hpp:15: boost_1_52_0/boost/date_time/int_adapter.hpp:233:41: warning: implicit conversion loses integer precision: 'long' to 'int_type' (aka 'unsigned int') [-Wshorten-64-to-32] return int_adapter(value_ + rhs.as_number()); ~~~~~~~~~~~ ~~~~~~~^~~~~~~~~~~~~~~~~ boost_1_52_0/boost/date_time/date.hpp:178:47: note: in instantiation of function template specialization 'boost::date_time::int_adapter::operator+' requested here return date_type(date_rep_type(days_) + dd.get_rep()); ^ boost_1_52_0/boost/date_time/time.hpp:145:49: note: in instantiation of member function 'boost::date_time::date::operator+' requested here time_ = (time_system::get_time_rep(date() + dd, time_of_day())); ^ boost_1_52_0/boost/date_time/posix_time/date_duration_operators.hpp:44:14: note: in instantiation of member function 'boost::date_time::base_time> >::operator+=' requested here return t += m.get_offset(t.date()); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:18: In file included from boost_1_52_0/boost/date_time/gregorian/gregorian_types.hpp:17: boost_1_52_0/boost/date_time/date.hpp:162:47: warning: implicit conversion loses integer precision: 'duration_rep_type' (aka 'long') to 'int_type' (aka 'unsigned int') [-Wshorten-64-to-32] return date_type(date_rep_type(days_) - dd.days()); ~~~~~~~~~~~~~ ^~~~~~~~~ boost_1_52_0/boost/date_time/period.hpp:93:21: note: in instantiation of member function 'boost::date_time::date::operator-' requested here last_(end_point - duration_rep::unit()) ^ boost_1_52_0/boost/date_time/date_parsing.hpp:308:14: note: in instantiation of member function 'boost::date_time::period::period' requested here return period(d1, d2); ^ boost_1_52_0/boost/date_time/gregorian/parsers.hpp:79:12: note: in instantiation of function template specialization 'boost::date_time::from_simple_string_type' requested here return date_time::from_simple_string_type(s); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:15: In file included from boost_1_52_0/boost/date_time/posix_time/ptime.hpp:12: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_system.hpp:13: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_config.hpp:17: In file included from boost_1_52_0/boost/date_time/time_resolution_traits.hpp:15: boost_1_52_0/boost/date_time/int_adapter.hpp:282:41: warning: implicit conversion loses integer precision: 'long' to 'int_type' (aka 'unsigned int') [-Wshorten-64-to-32] return int_adapter(value_ - rhs.as_number()); ~~~~~~~~~~~ ~~~~~~~^~~~~~~~~~~~~~~~~ boost_1_52_0/boost/date_time/date.hpp:160:47: note: in instantiation of function template specialization 'boost::date_time::int_adapter::operator-' requested here return date_type(date_rep_type(days_) - dd.get_rep()); ^ boost_1_52_0/boost/date_time/period.hpp:93:21: note: in instantiation of member function 'boost::date_time::date::operator-' requested here last_(end_point - duration_rep::unit()) ^ boost_1_52_0/boost/date_time/date_parsing.hpp:308:14: note: in instantiation of member function 'boost::date_time::period::period' requested here return period(d1, d2); ^ boost_1_52_0/boost/date_time/gregorian/parsers.hpp:79:12: note: in instantiation of function template specialization 'boost::date_time::from_simple_string_type' requested here return date_time::from_simple_string_type(s); ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:24: In file included from boost_1_52_0/boost/date_time/posix_time/time_formatters.hpp:16: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_types.hpp:20: boost_1_52_0/boost/date_time/dst_rules.hpp:57:49: warning: implicit conversion loses integer precision: 'long' to 'min_type' (aka 'int') [-Wshorten-64-to-32] if (time_of_day >= time_duration_type(0,offset,0)) { ~~~~~~~~~~~~~~~~~~ ^~~~~~ boost_1_52_0/boost/date_time/dst_rules.hpp:164:18: note: in instantiation of member function 'boost::date_time::dst_calculator::process_local_dst_start_day' requested here return process_local_dst_start_day(time_of_day, ^ boost_1_52_0/boost/date_time/dst_rules.hpp:116:16: note: in instantiation of member function 'boost::date_time::dst_calculator::local_is_dst' requested here return local_is_dst(current_day, time_of_day, ^ boost_1_52_0/boost/date_time/local_time/local_date_time.hpp:196:16: note: in instantiation of member function 'boost::date_time::dst_calculator::local_is_dst' requested here return dst_calculator::local_is_dst( ^ boost_1_52_0/boost/date_time/local_time/local_date_time.hpp:241:16: note: in instantiation of member function 'boost::local_time::local_date_time_base >::check_dst' requested here switch(check_dst(lt.date(), lt.time_of_day(), zone_)){ ^ boost_1_52_0/boost/date_time/local_time/conversion.hpp:23:9: note: in instantiation of member function 'boost::local_time::local_date_time_base >::is_dst' requested here if(lt.is_dst()){ ^ In file included from main.cpp:9: In file included from boost_1_52_0/boost/date_time.hpp:15: In file included from boost_1_52_0/boost/date_time/local_time/local_time.hpp:11: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time.hpp:24: In file included from boost_1_52_0/boost/date_time/posix_time/time_formatters.hpp:16: In file included from boost_1_52_0/boost/date_time/posix_time/posix_time_types.hpp:20: boost_1_52_0/boost/date_time/dst_rules.hpp:78:44: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] int offset = dst_end_offset_minutes-dst_length_minutes; ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ boost_1_52_0/boost/date_time/dst_rules.hpp:170:18: note: in instantiation of member function 'boost::date_time::dst_calculator::process_local_dst_end_day' requested here return process_local_dst_end_day(time_of_day, ^ boost_1_52_0/boost/date_time/dst_rules.hpp:116:16: note: in instantiation of member function 'boost::date_time::dst_calculator::local_is_dst' requested here return local_is_dst(current_day, time_of_day, ^ boost_1_52_0/boost/date_time/local_time/local_date_time.hpp:196:16: note: in instantiation of member function 'boost::date_time::dst_calculator::local_is_dst' requested here return dst_calculator::local_is_dst( ^ boost_1_52_0/boost/date_time/local_time/local_date_time.hpp:241:16: note: in instantiation of member function 'boost::local_time::local_date_time_base >::check_dst' requested here switch(check_dst(lt.date(), lt.time_of_day(), zone_)){ ^ boost_1_52_0/boost/date_time/local_time/conversion.hpp:23:9: note: in instantiation of member function 'boost::local_time::local_date_time_base >::is_dst' requested here if(lt.is_dst()){ ^ 15 warnings generated. }}} ",Bugs,new,To Be Determined,date_time,Boost 1.52.0,Cosmetic,,,