c++: excessive satisfaction in check_methods [PR108579]
commite7930c6750d03b28d922ebbbace20ba9d8622c6a
authorPatrick Palka <ppalka@redhat.com>
Fri, 3 Feb 2023 14:12:31 +0000 (3 09:12 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 3 Feb 2023 14:12:31 +0000 (3 09:12 -0500)
tree9cb5a58ce1711377f7bdeb4489da975119130c2a
parente8109bd87766be88e83fe88a44433dae16358a02
c++: excessive satisfaction in check_methods [PR108579]

In check_methods we're unnecessarily checking satisfaction for all
constructors and assignment operators, even those that don't look like
copy/move special members.  In the testcase below this manifests as an
unstable satisfaction error because the satisfaction result is first
determined to be false during check_methods (since A<int> is incomplete
at this point) and later true after completion of A<int>.

This patch fixes this simply by swapping the order of the
constraint_satisfied_p and copy/move_fn_p tests.

PR c++/108579

gcc/cp/ChangeLog:

* class.cc (check_methods): Swap order of constraints_satisfied_p
and copy/move_fn_p tests.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-pr108579.C: New test.
gcc/cp/class.cc
gcc/testsuite/g++.dg/cpp2a/concepts-pr108579.C [new file with mode: 0644]