From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A90F0386EC64; Mon, 29 Mar 2021 20:04:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A90F0386EC64 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/89102] 'common_type' of single abominable function should not have a nested typename Date: Mon, 29 Mar 2021 20:04:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 8.2.0 X-Bugzilla-Keywords: patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2021 20:04:39 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D89102 --- Comment #10 from CVS Commits --- The releases/gcc-10 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:7dea2f84f26d454331d34b8536c261b6e96205d7 commit r10-9608-g7dea2f84f26d454331d34b8536c261b6e96205d7 Author: Jonathan Wakely Date: Thu Aug 27 22:36:03 2020 +0100 libstdc++: Make std::chrono::duration use reduced ratio for period This implements the changes from P0548 "common_type and duration". That was a change for C++17, but as it corrects some issues introduced by DRs I'm also treating it as a DR and changing it for all modes from C++11 up. The main change is that duration::period no longer denotes P, but rather P::type, the reduced ratio. The unary operator+ and operator- members of duration should now return a duration using that reduced ratio. The requirement that common_type::type is the same type as common_type::type (rather than simply T) was already implemented for PR 89102. The standard says that duration::operator+() and duration::operator-() should return common_type_t, but that seems unnecessarily expensive to compute. This uses duration, period> which is the same type, so we avoid a common_type specialization. As an optimization, this also adds partial specializations of common_type for two durations of the same type, a single duration, two time_points of the same type, and a single time_point. These specializations avoid instantiating other specializations of common_type and one or both of __duration_common_type or __timepoint_common_type for the cases where the answer is trivial to obtain. libstdc++-v3/ChangeLog: * include/std/chrono (__duration_common_type): Ensure the reduced ratio is used. Remove unused partial specialization using __failure_type. (common_type): Pass reduced ratios to __duration_common_type. Add partial specializations for simple cases involving a single duration or time_point type. (duration::period): Use reduced ratio. (duration::operator+(), duration::operator-()): Return duration type using the reduced ratio. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Adjust expected errors. * testsuite/20_util/duration/requirements/reduced_period.cc: New test. (cherry picked from commit 82030d51017323c5706d58d8c8626324ece007e4)=