Implement P1816R0, class template argument deduction for aggregates.
authorJason Merrill <jason@redhat.com>
Fri, 15 Nov 2019 14:51:05 +0000 (09:51 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 15 Nov 2019 14:51:05 +0000 (09:51 -0500)
commit9b41ebbcdf9e33285a0eebeb7c841afe20e4a7c1
tree63d5b9a564430d47fdbe55993a501c3fa8fa098e
parentf6e20012ef792d659fec65fafecc29736c57f79c
Implement P1816R0, class template argument deduction for aggregates.

Rather than reimplement brace elision here, we call reshape_init and then
discard the result.  We needed to set CLASSTYPE_NON_AGGREGATE a bit more in
this patch, since outside a template it's set in check_bases_and_members.

* pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
(is_spec_or_derived): Split out from do_class_deduction.
(build_deduction_guide): Handle aggregate guide.
* class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
template.
* cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
aggregate.

From-SVN: r278298
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1z/class-deduction43.C
gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/class-deduction-aggr2.C [new file with mode: 0644]