c++: Refine check for CTAD placeholder [PR99586]
authorPatrick Palka <ppalka@redhat.com>
Fri, 2 Apr 2021 23:47:09 +0000 (19:47 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 2 Apr 2021 23:47:09 +0000 (19:47 -0400)
commitcf25e27faef75e265e659f39ef6b7d0f1695dfeb
treea8feac150e66d0be5bba71e19e8e2be9ca8ca20a
parent2a26351b598242c2fbce95d2a0baacce0084aec6
c++: Refine check for CTAD placeholder [PR99586]

In the below testcase, during finish_compound_literal for A<B{V}>{},
type_uses_auto finds and returns the CTAD placeholder for B{V}, which
tricks us into attempting CTAD on A<B{V}>{} and leads to bogus errors.

AFAICT 'type' will always be a bare 'auto' in the CTAD case so we don't
need to look deeply to find it; checking template_placeholder_p instead
should suffice here.

gcc/cp/ChangeLog:

PR c++/99586
* semantics.c (finish_compound_literal): Check
template_placeholder_p instead of type_uses_auto.

gcc/testsuite/ChangeLog:

PR c++/99586
* g++.dg/cpp2a/nontype-class42.C: New test.
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp2a/nontype-class42.C [new file with mode: 0644]