c++: Fix class NTTP constness handling [PR98810]
authorJason Merrill <jason@redhat.com>
Thu, 25 Feb 2021 21:47:53 +0000 (16:47 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 26 Feb 2021 03:57:48 +0000 (22:57 -0500)
commit7c657339d6a4a671b4cd8bc62ba4e0df6bfc7c72
tree12e25384d7e0d1bab3e76732dfa2f27b0e03eadc
parent0159535adb0e7400f2c6922f14a7602f6b90cf69
c++: Fix class NTTP constness handling [PR98810]

Here, when substituting still-dependent args into an alias template, we see
a non-const type because the default argument is non-const, and is not a
template parm object because it's still dependent.

gcc/cp/ChangeLog:

PR c++/98810
* pt.c (tsubst_copy) [VIEW_CONVERT_EXPR]: Add const
to a class non-type template argument that needs it.

gcc/testsuite/ChangeLog:

PR c++/98810
* g++.dg/cpp2a/nontype-class-defarg1.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/nontype-class-defarg1.C [new file with mode: 0644]