]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: partial ordering and dependent operator expr [PR105425]
authorPatrick Palka <ppalka@redhat.com>
Thu, 28 Apr 2022 17:10:56 +0000 (13:10 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 28 Apr 2022 17:34:58 +0000 (13:34 -0400)
commit38bdf2dccf6a239598ef808ed11a904e5f2a186e
tree892d5652be8e3fafa586a204b117583043ac7c62
parent6fba27af871a253f153b47a7eeec21bdfa14c3ec
c++: partial ordering and dependent operator expr [PR105425]

Here ever since r12-6022-gbb2a7f80a98de3 we stopped deeming the partial
specialization #2 to be more specialized than #1 ultimately because
dependent operator expressions now have a DEPENDENT_OPERATOR_TYPE type
instead of an empty type, and this made unify stop deducing T(2) == 1
for K during partial ordering for #1 and #2.

This minimal patch fixes this by making the relevant logic in unify
treat DEPENDENT_OPERATOR_TYPE like an empty type.

PR c++/105425

gcc/cp/ChangeLog:

* pt.cc (unify) <case TEMPLATE_PARM_INDEX>: Treat
DEPENDENT_OPERATOR_TYPE like an empty type.

gcc/testsuite/ChangeLog:

* g++.dg/template/partial-specialization13.C: New test.

(cherry picked from commit 509fd16da8528444dccc98cef57a18a295c3f1b4)
gcc/cp/pt.cc
gcc/testsuite/g++.dg/template/partial-specialization13.C [new file with mode: 0644]