public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7388] libstdc++: Fix narrowing conversion in year_month_day [PR 99265]
@ 2021-02-25 11:54 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-02-25 11:54 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-25 11:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-25 11:54 [gcc r11-7388] libstdc++: Fix narrowing conversion in year_month_day [PR 99265] Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).