]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: CWG 2789 and usings [PR116492]
authorPatrick Palka <ppalka@redhat.com>
Fri, 20 Sep 2024 16:33:13 +0000 (12:33 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 20 Sep 2024 16:33:13 +0000 (12:33 -0400)
commitee3efe06c9c49c04eaa4e195a7ae8774a1b3faa2
tree1cfecdc0e71817fa651608dc680379741001a11e
parent06557ba12b64c57368673c46a21b14cf4e6afb50
c++: CWG 2789 and usings [PR116492]

After CWG 2789, the "more constrained" tiebreaker for non-template
functions should exclude member functions that are defined in
different classes.  This patch implements this missing refinement.

In turn we can get rid of four-parameter version of object_parms_correspond
and call the main overload directly since now correspondence is only
only checked for members from the same class.

PR c++/116492
DR 2789

gcc/cp/ChangeLog:

* call.cc (object_parms_correspond): Remove.
(cand_parms_match): Return false for member functions that come
from different classes.  Adjust call to object_parms_correspond.
(joust): Update comment for the non-template "more constrained"
case.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-memfun4.C: Also compile in C++20 mode.
Expect ambiguity when candidates come from different classes.
* g++.dg/cpp2a/concepts-inherit-ctor12.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/call.cc
gcc/testsuite/g++.dg/cpp2a/concepts-inherit-ctor12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-memfun4.C