]> gcc.gnu.org Git - gcc.git/commit
c++: concept-ids and value-dependence [PR102412]
authorPatrick Palka <ppalka@redhat.com>
Wed, 22 Sep 2021 15:16:53 +0000 (11:16 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 6 Oct 2021 13:43:14 +0000 (09:43 -0400)
commit5a411459b73b65d8a1235a16d6e2aac4eed17338
tree569e15c0434846b0a7c2283225853bbaec99714f
parent729cf2ea979f396e706625b1669087d5920b8c2a
c++: concept-ids and value-dependence [PR102412]

The problem here is that uses_template_parms returns true for all
concept-ids (even those with non-dependent arguments), so when a concept-id
is used as a default template argument then during deduction the default
argument is considered dependent even after substituting into it, which
leads to deduction failure (from type_unification_real).

This patch fixes this by implementing the resolution of CWG 2446 which
says a concept-id is dependent only if its arguments are.

DR 2446
PR c++/102412

gcc/cp/ChangeLog:

* constexpr.c (cxx_eval_constant_expression)
<case TEMPLATE_ID_EXPR>: Check value_dependent_expression_p
instead of processing_template_decl.
* pt.c (value_dependent_expression_p) <case TEMPLATE_ID_EXPR>:
Return true only if any_dependent_template_arguments_p.
(instantiation_dependent_r) <case CALL_EXPR>: Remove this case.
<case TEMPLATE_ID_EXPR>: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-nondep2.C: New test.
* g++.dg/cpp2a/concepts-nondep3.C: New test.

(cherry picked from commit 9329344a6d81a6a5e3bd171167ebc7b158bb44f4)
gcc/cp/constexpr.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/concepts-nondep2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/concepts-nondep3.C [new file with mode: 0644]
This page took 0.066254 seconds and 6 git commands to generate.