]> gcc.gnu.org Git - gcc.git/commit
c++: unifying identical tmpls from current inst [PR108347]
authorPatrick Palka <ppalka@redhat.com>
Mon, 18 Sep 2023 18:41:07 +0000 (14:41 -0400)
committerPatrick Palka <ppalka@redhat.com>
Mon, 18 Sep 2023 18:41:07 +0000 (14:41 -0400)
commita6ac1fc64c3caed19da65c2e6b12f8ddaf551231
tree57df49e74ab211c89bd0dd1979a3dd118c7135cf
parent155178ccb5f5bc89dcc8261ae1b64bc2fbfdbd45
c++: unifying identical tmpls from current inst [PR108347]

Here more_specialized_partial_spec wrongly considers the two partial
specializations to be unordered ultimately because unify for identical
parm=arg=A<T>::C returns failure due to C being dependent.

This patch fixes this by relaxing unify's early-exit identity test to
also accept dependent decls; we can't deduce anything further from them
anyway.  In passing this patch removes the CONST_DECL case of unify:
we should never see the CONST_DECL version of a template parameter here,
and for other CONST_DECLs (such as enumerators) it seems we can rely on
them to already have been folded to their DECL_INITIAL.

PR c++/108347

gcc/cp/ChangeLog:

* pt.cc (unify): Return unify_success for identical dependent
DECL_P 'arg' and 'parm'.
<case CONST_DECL>: Remove handling.

gcc/testsuite/ChangeLog:

* g++.dg/template/ttp41.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/template/ttp41.C [new file with mode: 0644]
This page took 0.060714 seconds and 5 git commands to generate.