diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-03-02 07:38:37 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-03-02 07:38:37 -0500 |
commit | 04b10596fe2fec1aa6652c15fd389087a78a235f (patch) | |
tree | 9775aca8f0ee0e9d720a87764802a3314f3c9eda /libcpp | |
parent | d6378b9785b856785d6649d0f769a25b8bb47c9b (diff) | |
download | gcc-04b10596fe2fec1aa6652c15fd389087a78a235f.zip gcc-04b10596fe2fec1aa6652c15fd389087a78a235f.tar.gz gcc-04b10596fe2fec1aa6652c15fd389087a78a235f.tar.bz2 |
c++: Some preparatory type canonicalization fixes
The patches that follow revealed some latent type canonicalization
issues during normalization/satisfaction, due to normalization of
some constraint-expressions now being performed in different contexts
and more frequently (since the normalization caches get frequently
emptied in a checking compiler). The issues are:
1. In tsubst_parameter_mapping, we canonicalize the arguments of a
substituted TYPE_ARGUMENT_PACK only if the argument we started with
wasn't a TYPE_ARGUMENT_PACK. We should canonicalize a substituted
TYPE_ARGUMENT_PACK regardless of what we started with.
2. We currently set DECL_CONTEXT and CONSTRAINT_VAR_P on each of the
parameters introduced in a requires expression _after_ we're done
processing the requirements. But meanwhile we may have already
built and computed the canonical form of a type that uses one of
these PARM_DECLs (as say an operand to decltype). But the canonical
form depends on the result of cp_tree_equal, which in turn depends on
the value of CONSTRAINT_VAR_P and DECL_CONTEXT. So we must set these
fields earlier, before processing requirements.
3. In do_auto_deduction, we use the result of finish_decltype_type later
as a template argument, so we should canonicalize the result too.
(While we're here, we should pass 'complain' to finish_decltype_type,
which fixes the testcase auto1.C below.)
gcc/cp/ChangeLog:
* constraint.cc (tsubst_parameter_mapping): Canonicalize the
arguments of a substituted TYPE_ARGUMENT_PACK even if we've
started with a TYPE_ARGUMENT_PACK.
(finish_requires_expr): Don't set DECL_CONTEXT and
CONSTRAINT_VAR_P on each of the introduced parameters here.
* parser.c (cp_parser_requirement_parameter_list): Instead set
these fields earlier, here.
* pt.c (do_auto_deduction): Canonicalize the result of
do_auto_deduction. Pass 'complain' to finish_decltype_type.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1z/auto1.C: New test.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions