public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] cp: Fix comparison of PTRMEMFUNCs with capabilities
Date: Mon, 14 Mar 2022 10:35:32 +0000 (GMT)	[thread overview]
Message-ID: <20220314103532.92EE23853816@sourceware.org> (raw)

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

commit e715b1174f8bd9f75507523603bb5581130f17ed
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Wed Feb 9 16:15:00 2022 +0000

    cp: Fix comparison of PTRMEMFUNCs with capabilities
    
    When comparing the function pointers contained in two
    pointer-to-member-functions, we must drop the capabilities to compare
    the address values of the pointers. Note that we only need to adjust the
    call to build2 where we're building the comparison directly: when going
    through cp_build_binary_op we recursively ensure that the comparison is
    done on the address values.
    
    gcc/cp/ChangeLog:
    
            * typeck.c (cp_build_binary_op): When comparing PTRMEMFUNCs,
            ensure we compare the address values of the function pointer
            members.

Diff:
---
 gcc/cp/typeck.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index c467cdbbfdf..ede447221e1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5242,7 +5242,8 @@ cp_build_binary_op (const op_location_t &location,
 	      e1 = cp_build_binary_op (location,
 				       TRUTH_ORIF_EXPR, e1, e2, complain);
 	    }
-	  e2 = build2 (EQ_EXPR, boolean_type_node, pfn0, pfn1);
+	  e2 = build2 (EQ_EXPR, boolean_type_node,
+		       drop_capability (pfn0), drop_capability (pfn1));
 	  e = cp_build_binary_op (location,
 				  TRUTH_ANDIF_EXPR, e2, e1, complain);
 	  if (code == EQ_EXPR)


                 reply	other threads:[~2022-03-14 10:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220314103532.92EE23853816@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@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).