[gcc r11-7388] libstdc++: Fix narrowing conversion in year_month_day [PR 99265]
Jonathan Wakely
redi@gcc.gnu.org
Thu Feb 25 11:54:13 GMT 2021
https://gcc.gnu.org/g:75c74a83acee3f51e6753b8159fa600fe2d86810
commit r11-7388-g75c74a83acee3f51e6753b8159fa600fe2d86810
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Feb 25 11:48:18 2021 +0000
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.
Diff:
---
libstdc++-v3/include/std/chrono | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index feb2c2a1fad..eef503af274 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.
More information about the Libstdc++-cvs
mailing list