From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C3999385DC01; Fri, 28 Jul 2023 17:32:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3999385DC01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690565552; bh=fFgVwAjWFnfNrb2auDDEqN4VGHY7ulpTk2cHtQMvg48=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ERHQQgWCFR7izphN/ewxmUCvKi+FjfY4BJDDjZyhjgEWiel4GAkYXFdEutEWU/wwm ogPIs5mA+DyqPP32qCAFtiKam4u9+krhrTVWk5oGKgXRdKTki+1N0mDfw7VRGPepkR 1vkc7HVtJKGQTgh5no8Nyw8dJ3NXPYv5i/kTwQSU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110593] The std::ratio meta arithmetic can accept non-std::ratio Date: Fri, 28 Jul 2023 17:32:32 +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: 14.0 X-Bugzilla-Keywords: accepts-invalid 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: 14.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110593 --- Comment #3 from CVS Commits --- The releases/gcc-13 branch has been updated by Jonathan Wakely : https://gcc.gnu.org/g:13dd1501a1adc5d76c13ae36368bff3c3b64da37 commit r13-7627-g13dd1501a1adc5d76c13ae36368bff3c3b64da37 Author: Jonathan Wakely Date: Wed Jul 19 18:18:46 2023 +0100 libstdc++: Check for std::ratio in arithmetic and comparisons [PR110593] The standard says that it should be ill-formed to use std::ratio_equal etc. with types which are not specializations of std::ratio. This implements that requirement. We don't need to add assertions to every one of the class templates, because many of them are implemented in terms of other ones. For example, ratio_divide and ratio_subtract can rely on the assertions in ratio_multiply and ratio_add respectively. libstdc++-v3/ChangeLog: PR libstdc++/110593 * include/bits/chrono.h (duration): Improve static assert messages. (__is_ratio): Move to ... * include/std/ratio (__is_ratio): ... here. (__is_ratio_v): New variable template and partial specialization. (__are_both_ratios): New function template. (__ratio_multiply, ratio_equal, ratio_less, __ratio_add): Add static assertion. * testsuite/20_util/ratio/requirements/type_constraints.cc: New test. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust expected error. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. (cherry picked from commit 2d614822e9ea2a3d8800045d66e3220743753d09)=