]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wnarrowing warnings
authorJonathan Wakely <jwakely@redhat.com>
Thu, 10 Sep 2020 17:47:08 +0000 (18:47 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 10 Sep 2020 17:47:08 +0000 (18:47 +0100)
libstdc++-v3/ChangeLog:

* include/bits/fs_path.h (path::_List::type()): Avoid narrowing
conversion.
* include/std/chrono (operator+(const year&, const years&)):
Likewise.

libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/include/std/chrono

index 26ddf0afec41c78ddc5341c09ef1d0b920486fef..5a0917c582d46ef8bc1af03ae780af7ad0578c6b 100644 (file)
@@ -667,7 +667,7 @@ namespace __detail
       ~_List() = default;
 
       _Type type() const noexcept
-      { return _Type{reinterpret_cast<uintptr_t>(_M_impl.get()) & 0x3}; }
+      { return _Type(reinterpret_cast<uintptr_t>(_M_impl.get()) & 0x3); }
 
       void type(_Type) noexcept;
 
index afee7859c6ddbeb0eb54f68322aaca527750ebff..9b9fd2bd42d9daa60176c4b219805ec4d587d20a 100644 (file)
@@ -1591,7 +1591,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       friend constexpr year
       operator+(const year& __x, const years& __y) noexcept
-      { return year{int{__x} + __y.count()}; }
+      { return year{int{__x} + static_cast<int>(__y.count())}; }
 
       friend constexpr year
       operator+(const years& __x, const year& __y) noexcept