From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 2BF143972437; Thu, 10 Sep 2020 18:16:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BF143972437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599761804; bh=2OaaBT+46jpRiT5IOxzUDwNHHLd5sunLNUTfbfM2flM=; h=From:To:Subject:Date:From; b=esyw9kEjN+UwRZH5J+EiWufmz/iFnBlI6edTeeqIEXh+u4myqPFM/MBiJnUc2VA/+ SK3rZBgvwZHV7IpANMakq1fLKC6QFQ+KAW05vq4NK+hH95w5I18fod/eh0sVNbHMRE 5m6hq1oUZiD4FIkjkOP2mqe1azOnMj8O2uBJjaps= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-3121] libstdc++: Fix -Wnarrowing warnings X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: f9189e10889379ce9582592926db342109f57324 X-Git-Newrev: b6b9fd4af9ac46a8bb19a906e4c2afa14da91017 Message-Id: <20200910181644.2BF143972437@sourceware.org> Date: Thu, 10 Sep 2020 18:16:44 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2020 18:16:44 -0000 https://gcc.gnu.org/g:b6b9fd4af9ac46a8bb19a906e4c2afa14da91017 commit r11-3121-gb6b9fd4af9ac46a8bb19a906e4c2afa14da91017 Author: Jonathan Wakely Date: Thu Sep 10 18:47:08 2020 +0100 libstdc++: Fix -Wnarrowing warnings libstdc++-v3/ChangeLog: * include/bits/fs_path.h (path::_List::type()): Avoid narrowing conversion. * include/std/chrono (operator+(const year&, const years&)): Likewise. Diff: --- libstdc++-v3/include/bits/fs_path.h | 2 +- libstdc++-v3/include/std/chrono | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 26ddf0afec4..5a0917c582d 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -667,7 +667,7 @@ namespace __detail ~_List() = default; _Type type() const noexcept - { return _Type{reinterpret_cast(_M_impl.get()) & 0x3}; } + { return _Type(reinterpret_cast(_M_impl.get()) & 0x3); } void type(_Type) noexcept; diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index afee7859c6d..9b9fd2bd42d 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -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(__y.count())}; } friend constexpr year operator+(const years& __x, const year& __y) noexcept