diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-02-25 11:48:18 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-02-25 11:53:59 +0000 |
commit | 75c74a83acee3f51e6753b8159fa600fe2d86810 (patch) | |
tree | a586b64c1d3263b531f653275c687475d975ebbe | |
parent | 7244879b883cb3405bdd98f051d50a2f36394e79 (diff) | |
download | gcc-75c74a83acee3f51e6753b8159fa600fe2d86810.zip gcc-75c74a83acee3f51e6753b8159fa600fe2d86810.tar.gz gcc-75c74a83acee3f51e6753b8159fa600fe2d86810.tar.bz2 |
libstdc++: Fix narrowing conversion in year_month_day [PR 99265]
libstdc++-v3/ChangeLog:
PR libstdc++/99265
* include/std/chrono (year_month_day::_S_from_days): Cast long
to int explicitly.
-rw-r--r-- | libstdc++-v3/include/std/chrono | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index feb2c2a..eef503a 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -2481,8 +2481,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const auto __m1 = __j ? __m0 - 12 : __m0; const auto __d1 = __d0 + 1; - return year_month_day{chrono::year{__y1 + __z2}, chrono::month{__m1}, - chrono::day{__d1}}; + return year_month_day{chrono::year{static_cast<int>(__y1 + __z2)}, + chrono::month{__m1}, chrono::day{__d1}}; } // Days since 1970/01/01. |