]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: constrained template friend class matching [PR96830]
authorPatrick Palka <ppalka@redhat.com>
Tue, 14 Mar 2023 23:12:08 +0000 (19:12 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 14 Mar 2023 23:12:08 +0000 (19:12 -0400)
commitec62dc95c4f8776c9f4eff2a9a06f9aef6a2d98a
treeaeffebd9f1719a3e4b55b6a655fa07a0f88de044
parent578f633ddabd62b41beed635697c95ee2aaa39c0
c++: constrained template friend class matching [PR96830]

When instantiating a constrained template friend naming an already
declared class template, tsubst_friend_class erroneously passes to
redeclare_class_template the existing template's constraints instead of
those of the friend declaration, which causes the constraint comparison
check therein to trivially succeed and we fail to diagnose legitimate
constraint mismatches.

PR c++/96830

gcc/cp/ChangeLog:

* pt.cc (redeclare_class_template): Add missing "of" in
constraint mismatch diagnostic.
(tsubst_friend_class): For an already declared class template,
substitute and pass the friend declaration's constraints to
redeclare_class_template instead of passing the existing
template's constraints.

gcc/testsuite/ChangeLog:

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