https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104294
--- Comment #4 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:76dc465aaf1b74bf92143510b6db5671e1c053d6 commit r12-6950-g76dc465aaf1b74bf92143510b6db5671e1c053d6 Author: Patrick Palka <ppa...@redhat.com> Date: Mon Jan 31 15:27:58 2022 -0500 c++: CTAD for class tmpl defined inside partial spec [PR104294] Here during deduction guide generation for the nested class template B<char(int)>::C, the computation of outer_args yields the template arguments relative to the primary template for B (i.e. {char(int)}) but what we really want is those relative to C's enclosing scope, the partial specialization of B (i.e. {char, int}). PR c++/104294 gcc/cp/ChangeLog: * pt.cc (ctor_deduction_guides_for): Correct computation of outer_args. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction106.C: New test.