https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96830
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:ec62dc95c4f8776c9f4eff2a9a06f9aef6a2d98a commit r13-6676-gec62dc95c4f8776c9f4eff2a9a06f9aef6a2d98a Author: Patrick Palka <ppa...@redhat.com> Date: Tue Mar 14 19:12:08 2023 -0400 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.