c++: Tolerate empty initial args during normalization [PR97412]
authorPatrick Palka <ppalka@redhat.com>
Thu, 29 Oct 2020 18:02:59 +0000 (14:02 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 29 Oct 2020 18:02:59 +0000 (14:02 -0400)
commit5681668765e233735b4c5e6a305e73ae1f80a328
tree42d42a5806738beffa48429082f97ee3ab89fb72
parent57ec9b687b0c1d83e477b7b7433c11d814489259
c++: Tolerate empty initial args during normalization [PR97412]

When normalizing the constraint-expression of a nested-requirement, we
pass NULL_TREE as the initial template arguments for normalization, but
tsubst_argument_pack is not prepared to handle a NULL_TREE args vector.
This causes us to ICE when normalizing a variadic concept as part of a
nested-requirement.

This patch fixes the ICE by guarding the call to tsubst_template_args in
normalize_concept_check appropriately.  This will also enable us to
simplify many of the normalization routines to just pass NULL_TREE
(instead of a set of generic template arguments) as the initial template
arguments.

gcc/cp/ChangeLog:

PR c++/97412
* constraint.cc (normalize_concept_check): Don't call
tsubst_template_args when 'args' is NULL.

gcc/testsuite/ChangeLog:

PR c++/97412
* g++.dg/cpp2a/concepts-variadic2.C: New test.
gcc/cp/constraint.cc
gcc/testsuite/g++.dg/cpp2a/concepts-variadic2.C [new file with mode: 0644]