public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/110593] The std::ratio meta arithmetic can accept non-std::ratio
Date: Mon, 18 Mar 2024 14:04:51 +0000	[thread overview]
Message-ID: <bug-110593-4-1HvmbpESOA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110593-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110593

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:ae8302e18f15f0befb372762b20a3a790a19a925

commit r12-10238-gae8302e18f15f0befb372762b20a3a790a19a925
Author: Jonathan Wakely <jwakely@redhat.com>
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)

  parent reply	other threads:[~2024-03-18 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08  5:01 [Bug libstdc++/110593] New: " hewillk at gmail dot com
2023-07-08  7:20 ` [Bug libstdc++/110593] " redi at gcc dot gnu.org
2023-07-19 18:23 ` redi at gcc dot gnu.org
2023-07-19 22:43 ` cvs-commit at gcc dot gnu.org
2023-07-19 23:33 ` redi at gcc dot gnu.org
2023-07-28 17:32 ` cvs-commit at gcc dot gnu.org
2024-03-18 14:04 ` cvs-commit at gcc dot gnu.org [this message]
2024-03-18 14:11 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110593-4-1HvmbpESOA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).