]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: explicit spec of constrained member tmpl [PR107522]
authorPatrick Palka <ppalka@redhat.com>
Thu, 16 Jan 2025 21:40:08 +0000 (16:40 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 16 Jan 2025 21:40:08 +0000 (16:40 -0500)
commit62daa81308c6c187059fcad98377146e30725fa5
treed682a8b0da15e42a1f45f7e3922349d134bbebed
parentd72e5b7be203f9bb9b7e2aac8dd812af7f70859f
c++: explicit spec of constrained member tmpl [PR107522]

When defining a explicit specialization of a constrained member template
(of a class template) such as f and g in the below testcase, the
DECL_TEMPLATE_PARMS of the corresponding TEMPLATE_DECL are partially
instantiated, whereas its associated constraints are carried over
from the original template and thus are in terms of the original
DECL_TEMPLATE_PARMS.  So during normalization for such an explicit
specialization we need to consider the (parameters of) the most general
template, since that's what the constraints are in terms of and since we
always use the full set of template arguments during satisfaction.

PR c++/107522

gcc/cp/ChangeLog:

* constraint.cc (get_normalized_constraints_from_decl): Use the
most general template for an explicit specialization of a
member template.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-explicit-spec7.C: New test.

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