diff options
author | Marek Polacek <polacek@redhat.com> | 2020-06-23 18:07:34 -0400 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:15:24 -0300 |
commit | 7828ff31a7cc96263bc838ebc8d6296f59ba0d12 (patch) | |
tree | bfff8cbdedbc447051fda0f3a3254cbd24087bdf /gcc/fortran | |
parent | f35b15a0758c8d71314bf9828ae9351efc5f8107 (diff) | |
download | gcc-7828ff31a7cc96263bc838ebc8d6296f59ba0d12.zip gcc-7828ff31a7cc96263bc838ebc8d6296f59ba0d12.tar.gz gcc-7828ff31a7cc96263bc838ebc8d6296f59ba0d12.tar.bz2 |
c++: Fix CTAD for aggregates in template [PR95568]
95568 complains that CTAD for aggregates doesn't work within
requires-clause and it turned out that it doesn't work when we try
the deduction in a template. The reason is that maybe_aggr_guide
creates a guide that can look like this
template<class T> X(decltype (X<T>::x))-> X<T>
where the parameter is a decltype, which is a non-deduced context. So
the subsequent build_new_function_call fails because unify_one_argument
can't deduce anything from it ([temp.deduct.type]: "If a template
parameter is used only in non-deduced contexts and is not explicitly
specified, template argument deduction fails.")
Those decltypes come from finish_decltype_type. We can just use
TREE_TYPE instead. I pondered using unlowered_expr_type, but that
didn't make any difference for the FIELD_DECLs I saw in
class-deduction-aggr6.C.
gcc/cp/ChangeLog:
PR c++/95568
* pt.c (collect_ctor_idx_types): Use TREE_TYPE.
gcc/testsuite/ChangeLog:
PR c++/95568
* g++.dg/cpp2a/class-deduction-aggr5.C: New test.
* g++.dg/cpp2a/class-deduction-aggr6.C: New test.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions