diff options
author | Patrick Palka <ppalka@redhat.com> | 2025-08-04 16:51:00 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2025-08-04 16:51:00 -0400 |
commit | b9f1cc4e119da9205cb8438f0132c62a19afe4ae (patch) | |
tree | 4ba6a78e7add8209b49d746bbde824bdac16bcce /libcpp/include/cpplib.h | |
parent | b51ca7d2f548ffdad03fa779e3ff7bcc3441ff03 (diff) | |
download | gcc-b9f1cc4e119da9205cb8438f0132c62a19afe4ae.zip gcc-b9f1cc4e119da9205cb8438f0132c62a19afe4ae.tar.gz gcc-b9f1cc4e119da9205cb8438f0132c62a19afe4ae.tar.bz2 |
c++: constrained memfn vs corresponding using [PR121351]
The b.f(42) calls in the below testcases started to get rejected as
ambiguous after r15-3740 which corrected our inheritedness tiebreaker to
only apply to constructors (and not all member functions) as per CWG2273.
But arguably these calls should still be valid regardless of the
tiebreaker because B::f corresponds to and therefore hides A::f, so
there should only be a single candidate in the first place. This
doesn't happen because when determining correspondence we compare
the members' uninstantiated constraints instead of their partially
substituted constraints as in other declaration matching situations.
It doesn't really make sense to compare uninstantiated constraints
from two different template contexts.
This patch fixes this by substituting in outer template arguments before
comparing constraints of two potentially corresponding member functions.
PR c++/121351
PR c++/119859
gcc/cp/ChangeLog:
* class.cc (add_method): Substitute outer template arguments
into constraints before comparing them if the declarations are
from different classes.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-using5.C: New test.
* g++.dg/cpp2a/concepts-using5a.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libcpp/include/cpplib.h')
0 files changed, 0 insertions, 0 deletions