c++: redeclaring member of constrained class template [PR96830]
authorPatrick Palka <ppalka@redhat.com>
Tue, 14 Mar 2023 23:14:29 +0000 (19:14 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 14 Mar 2023 23:14:29 +0000 (19:14 -0400)
commitcd5baeb4489b6a953abbc7f02fea457fd9ed2f83
treea29cdf36c2d282ce80bc3bccf90006b6678f8639
parentec62dc95c4f8776c9f4eff2a9a06f9aef6a2d98a
c++: redeclaring member of constrained class template [PR96830]

An out-of-line definition of a member of a constrained class template
needs to repeat the template's constraints, but it turns out we don't
verify anywhere that the two sets of constraints match.  This patch
adds such a check to push_template_decl, nearby a similar consistency
check for the template parameter list lengths.

PR c++/96830

gcc/cp/ChangeLog:

* pt.cc (push_inline_template_parms_recursive): Set
TEMPLATE_PARMS_CONSTRAINTS.
(push_template_decl): For an out-of-line declaration, verify
constraints for each enclosing template scope match those of the
original template declaratation.

gcc/testsuite/ChangeLog:

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