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 c++/97420] [10 Regression] NTTP function reference cannot bind to noexcept function
Date: Fri, 30 Jun 2023 04:04:52 +0000	[thread overview]
Message-ID: <bug-97420-4-dTFn4Ll6SF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97420-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

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

commit r10-11482-gad42219766d0e67bede2c9bd94c98082cde42518
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed May 26 08:35:31 2021 -0400

    c++: Fix reference NTTP binding to noexcept fn [PR97420]

    Here, in C++17 mode, convert_nontype_argument_function is rejecting
    binding a non-noexcept function reference template parameter to a
    noexcept function (encoded as the template argument '*(int (&) (int)) &f').

    The first roadblock to making this work is that the argument is wrapped
    an an implicit INDIRECT_REF, so we need to unwrap it before calling
    strip_fnptr_conv.

    The second roadblock is that the NOP_EXPR cast converts from a function
    pointer type to a reference type while simultaneously removing the
    noexcept qualification, and fnptr_conv_p doesn't consider this cast to
    be a function pointer conversion.  This patch fixes this by making
    fnptr_conv_p treat REFERENCE_TYPEs and POINTER_TYPEs interchangeably.

    Finally, in passing, this patch also simplifies noexcept_conv_p by
    removing a bunch of redundant checks already performed by its only
    caller fnptr_conv_p.

            PR c++/97420

    gcc/cp/ChangeLog:

            * cvt.c (noexcept_conv_p): Remove redundant checks and simplify.
            (fnptr_conv_p): Don't call non_reference.  Use INDIRECT_TYPE_P
            instead of TYPE_PTR_P.
            * pt.c (convert_nontype_argument_function): Look through
            implicit INDIRECT_REFs before calling strip_fnptr_conv.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/noexcept68.C: New test.

    (cherry picked from commit b4329e3dd6fb7c78948fcf9d2f5b9d873deec284)

  parent reply	other threads:[~2023-06-30  4:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 13:51 [Bug c++/97420] New: error: no matching function for call to 'find_if' tangyixuan at mail dot dlut.edu.cn
2020-10-14 13:54 ` [Bug c++/97420] " redi at gcc dot gnu.org
2020-10-14 14:08 ` redi at gcc dot gnu.org
2021-04-27  1:51 ` [Bug c++/97420] [8/9/10/11/12 Regression] NTTP function reference cannot bind to noexcept function ppalka at gcc dot gnu.org
2021-04-30  8:08 ` rguenth at gcc dot gnu.org
2021-05-07 12:58 ` ppalka at gcc dot gnu.org
2021-05-07 12:58 ` ppalka at gcc dot gnu.org
2021-05-14  9:54 ` [Bug c++/97420] [9/10/11/12 " jakub at gcc dot gnu.org
2021-05-26 13:08 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2021-07-13 14:03 ` cvs-commit at gcc dot gnu.org
2021-07-13 14:03 ` [Bug c++/97420] [9/10 " ppalka at gcc dot gnu.org
2022-05-27  9:43 ` [Bug c++/97420] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-06-30  4:04 ` cvs-commit at gcc dot gnu.org [this message]
2023-07-07  9:09 ` rguenth 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-97420-4-dTFn4Ll6SF@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).