libstdc++: Fix conversions from date types to integers [PR 99301]

The conversions to integer types are explicit, so need to use the
correct type. Converting to uint32_t only works if that is the same type
as unsigned.

libstdc++-v3/ChangeLog:

	PR libstdc++/99301
	* include/std/chrono (year_month_day::_M_days_since_epoch()):
	Convert chrono::month and chrono::day to unsigned before
	converting to uint32_t.
This commit is contained in:
Jonathan Wakely 2021-02-27 12:50:53 +00:00
parent 652623f7c6
commit 699672d4dc

View file

@ -2496,8 +2496,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto constexpr __r2_e3 = static_cast<uint32_t>(536895458);
const auto __y1 = static_cast<uint32_t>(static_cast<int>(_M_y)) - __z2;
const auto __m1 = static_cast<uint32_t>(_M_m);
const auto __d1 = static_cast<uint32_t>(_M_d);
const auto __m1 = static_cast<uint32_t>(static_cast<unsigned>(_M_m));
const auto __d1 = static_cast<uint32_t>(static_cast<unsigned>(_M_d));
const auto __j = static_cast<uint32_t>(__m1 < 3);
const auto __y0 = __y1 - __j;