c++: DEPENDENT_OPERATOR_TYPE as type of NTTP [PR104074]
authorPatrick Palka <ppalka@redhat.com>
Tue, 18 Jan 2022 19:50:06 +0000 (14:50 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 18 Jan 2022 19:50:06 +0000 (14:50 -0500)
commit3c4a54adb2164315d18fd8980c0fc37eb3d22252
tree628d008a2cb57b6b5bdc07d8fb34cde1056d8e91
parentdad495e30135904b0d0305eab8c0ce5f838440d4
c++: DEPENDENT_OPERATOR_TYPE as type of NTTP [PR104074]

We're incorrectly rejecting the below testcase during template argument
coercion because invalid_nontype_parm_type_p returns true for
DEPENDENT_OPERATOR_TYPE in C++17 mode.

This patch fixes this by partially rewriting invalid_nontype_parm_type_p
in terms of WILDCARD_TYPE_P, for which DEPENDENT_OPERATOR_TYPE is true,
so that the predicate handles wildcard types consistently.

PR c++/104074

gcc/cp/ChangeLog:

* pt.cc (invalid_nontype_parm_type_p): Use WILDCARD_TYPE_P so
that we return false for DEPENDENT_OPERATOR_TYPE too.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/nontype-auto20.C: New test.
gcc/cp/pt.cc
gcc/testsuite/g++.dg/cpp1z/nontype-auto20.C [new file with mode: 0644]