https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105110
--- Comment #2 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:95533fe4f014c10dd18de649927668aba6117daf commit r12-7966-g95533fe4f014c10dd18de649927668aba6117daf Author: Patrick Palka <ppa...@redhat.com> Date: Fri Apr 1 14:56:20 2022 -0400 c++: deducing from class type of NTTP [PR105110] Here when attempting to deduce T in the NTTP type A<T> from the argument type 'const A<int>', we give up due to the const: types âA<T>â and âconst A<int>â have incompatible cv-qualifiers But since the type of an NTTP cannot be cv-qualified, it seems natural to ignore cv-qualifiers on the argument type before attempting to unify the two types. PR c++/105110 gcc/cp/ChangeLog: * pt.cc (unify) <case TEMPLATE_PARM_INDEX>: Drop cv-quals from the argument type of an NTTP before deducing from it. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/nontype-class52.C: New test.