c++: do_class_deduction and dependent init [PR93383]
authorPatrick Palka <ppalka@redhat.com>
Sat, 24 Apr 2021 04:14:29 +0000 (00:14 -0400)
committerPatrick Palka <ppalka@redhat.com>
Sat, 24 Apr 2021 04:14:29 +0000 (00:14 -0400)
commitbcd77b7b9f35bd5b559ed593c3b3e346c1e6f364
treee88f062f4be1c92aecddaf6953f76ade32c1b36f
parent5f1a2cb9c2dc09eed53da5d5787d14bec700b10b
c++: do_class_deduction and dependent init [PR93383]

Here we're crashing during CTAD with a dependent initializer (performed
from convert_template_argument) because one of the initializer's
elements has an empty TREE_TYPE, which ends up making resolve_args
unhappy.

Besides the case where we're initializing one template placeholder
from another, which is already specifically handled earlier in
do_class_deduction, it seems we can't in general correctly resolve a
template placeholder using a dependent initializer, so this patch makes
the function just punt until instantiation time instead.

gcc/cp/ChangeLog:

PR c++/89565
PR c++/93383
PR c++/95291
PR c++/99200
PR c++/99683
* pt.c (do_class_deduction): Punt if the initializer is
type-dependent.

gcc/testsuite/ChangeLog:

PR c++/89565
PR c++/93383
PR c++/95291
PR c++/99200
PR c++/99683
* g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive.
* g++.dg/cpp2a/nontype-class45.C: New test.
* g++.dg/cpp2a/nontype-class46.C: New test.
* g++.dg/cpp2a/nontype-class47.C: New test.
* g++.dg/cpp2a/nontype-class48.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp2a/nontype-class39.C
gcc/testsuite/g++.dg/cpp2a/nontype-class45.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class46.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class47.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/nontype-class48.C [new file with mode: 0644]