public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] cp: Fix comparison of PTRMEMFUNCs with capabilities
@ 2022-03-14 10:35 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-03-14 10:35 UTC (permalink / raw)
  To: gcc-cvs

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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-14 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-14 10:35 [gcc(refs/vendors/ARM/heads/morello)] cp: Fix comparison of PTRMEMFUNCs with capabilities Matthew Malcomson

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).