diff options
author | Marek Polacek <polacek@redhat.com> | 2020-06-23 18:07:34 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2020-06-29 10:59:40 -0400 |
commit | b1005f553d3543bb56dc6b9b34ee35455d697ca4 (patch) | |
tree | ddc4fa81ca1981181cb8c136953fe8abd262e86d /gcc/cp/method.c | |
parent | e6cc67f6616c96f3e18a434e0c74ba2f3818cb6d (diff) | |
download | gcc-b1005f553d3543bb56dc6b9b34ee35455d697ca4.zip gcc-b1005f553d3543bb56dc6b9b34ee35455d697ca4.tar.gz gcc-b1005f553d3543bb56dc6b9b34ee35455d697ca4.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/cp/method.c')
0 files changed, 0 insertions, 0 deletions