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++/100894] The std::common_reference implementation seems to be wrong
Date: Mon, 14 Jun 2021 20:17:57 +0000	[thread overview]
Message-ID: <bug-100894-4-A8fpjZvzsy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100894-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

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

commit r12-1437-gc37b5ddcc88e0cc0f6a4ad609eda51021df0f6bb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 14 20:31:00 2021 +0100

    libstdc++: Fix common_reference for non-reference results [PR100894]

    The result of COMMON-REF(A&, B&&) where they have no common reference
    type should not be a reference. The implementation of COMMON-REF fails
    to check that the result is a reference, so is well-formed when it
    shouldn't be. This means that common_reference uses that result when it
    shouldn't.

    The fix is to reject the result of COMMON-REF(A, B) if it's not a
    reference, so that common_reference falls through to the next case,
    which uses COND-RES, which yields a non-reference result.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/100894
            * include/std/type_traits (__common_ref_impl<X&, Y&>): Only
            use the type if it's a reference.
            * testsuite/20_util/common_reference/100894.cc: New test.

  parent reply	other threads:[~2021-06-14 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 16:35 [Bug libstdc++/100894] New: " hewillk at gmail dot com
2021-06-14 17:25 ` [Bug libstdc++/100894] " redi at gcc dot gnu.org
2021-06-14 19:30 ` redi at gcc dot gnu.org
2021-06-14 20:17 ` cvs-commit at gcc dot gnu.org [this message]
2021-06-14 21:49 ` cvs-commit at gcc dot gnu.org
2021-08-10 16:07 ` cvs-commit at gcc dot gnu.org
2021-08-10 16:07 ` 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-100894-4-A8fpjZvzsy@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).