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++/99374] [8/9/10/11 Regression] C++17/20 mode fails to recognise pointer-to-member functions of incomplete types in conditional expression
Date: Fri, 05 Mar 2021 23:08:30 +0000	[thread overview]
Message-ID: <bug-99374-4-RdQjdN0ICf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99374-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:02a3554879001e8f1405d17e096ed68fc3f76975

commit r11-7536-g02a3554879001e8f1405d17e096ed68fc3f76975
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Mar 4 14:25:01 2021 -0500

    c++: Pointer-to-member fn conversion with noexcept [PR99374]

    The issue in this PR is that we wrongly reject converting pointers to
    member function of incomplete types, one of which has noexcept.  Recall
    that pointers (including pointers to member functions) to non-throwing
    functions can be implicitly converted to potentially-throwing functions
    (but not vice versa).

    We reject the conversion when called from can_convert_arg_bad because
    standard_conversion can't create such a conversion.  It comes down to
    the DERIVED_FROM_P check in the TYPE_PTRMEMFUNC_P block.  It considers
    every class derived from itself, but not when the class is incomplete.
    But surely we want to reach fnptr_conv_p when tbase is fbase (one of
    them could be an alias to the other so use same_type_p instead of ==).

    Another approach would be to not perform DERIVED_FROM_P at all when
    either tbase or fbase are incomplete (so perhaps something like at the
    end of ptr_reasonably_similar).

    gcc/cp/ChangeLog:

            PR c++/99374
            * call.c (standard_conversion): When converting pointers to
            member, don't return NULL when the bases are equivalent but
            incomplete.

    gcc/testsuite/ChangeLog:

            PR c++/99374
            * g++.dg/cpp1z/noexcept-type23.C: New test.

  parent reply	other threads:[~2021-03-05 23:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03 23:57 [Bug c++/99374] New: " cjdb.ns at gmail dot com
2021-03-04 10:38 ` [Bug c++/99374] " redi at gcc dot gnu.org
2021-03-04 10:41 ` redi at gcc dot gnu.org
2021-03-04 10:44 ` redi at gcc dot gnu.org
2021-03-04 18:42 ` [Bug c++/99374] [8/9/10/11 Regression] " mpolacek at gcc dot gnu.org
2021-03-04 18:43 ` mpolacek at gcc dot gnu.org
2021-03-05 23:08 ` cvs-commit at gcc dot gnu.org [this message]
2021-03-05 23:09 ` [Bug c++/99374] [8/9/10 " mpolacek at gcc dot gnu.org
2021-04-09 22:36 ` cvs-commit at gcc dot gnu.org
2021-04-09 22:37 ` mpolacek 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-99374-4-RdQjdN0ICf@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).