c++: cand_parms_match and reversed candidates
commita0e3d2ff6219d860c5108b3d1ff25a05a9a5559f
authorJason Merrill <jason@redhat.com>
Thu, 11 Jan 2024 04:18:23 +0000 (10 23:18 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 12 Jan 2024 14:11:24 +0000 (12 09:11 -0500)
treefd065d1200ec0ee56357b890e9ea43e2cf201219
parent846794ead2982fc85a3b1a83bbb831fa096b2b7c
c++: cand_parms_match and reversed candidates

When considering whether the candidate parameters match, according to the
language we're considering the synthesized reversed candidate, so we should
compare the parameters in swapped order.  In this situation it doesn't make
sense to consider whether object parameters correspond, since we're
comparing an object parameter to a non-object parameter, so I generalized
xobj_iobj_parameters_correspond accordingly.

As I refine cand_parms_match, more behaviors need to differ between its
original use to compare the original templates for two candidates, and the
later use to decide whether to compare constraints.  So now there's a
parameter to select between the semantics.

gcc/cp/ChangeLog:

* call.cc (reversed_match): New.
(enum class pmatch): New enum.
(cand_parms_match): Add match_kind parm.
(object_parms_correspond): Add fn parms.
(joust): Adjust.
* class.cc (xobj_iobj_parameters_correspond): Rename to...
(iobj_parm_corresponds_to): ...this.  Take the other
type instead of a second function.
(object_parms_correspond): Adjust.
* cp-tree.h (iobj_parm_corresponds_to): Declare.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-memfun4.C: Change expected
reversed handling.
gcc/cp/call.cc
gcc/cp/class.cc
gcc/cp/cp-tree.h
gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C