mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 15:50:55 +08:00
This sets up the functionality for controlling the initial set of template parameters to pass to normalization when dealing with a constraint-expression that is not associated with some constrained declaration, for instance when normalizing a nested requirement of a requires expression, or the constraints on a placeholder type. The main new ingredient here is the data member norm_info::initial_parms which can be set by callers of the normalization routines to communicate the in-scope template parameters for the supplied constraint-expression, rather than always falling back to using current_template_parms. This patch then uses this functionality in our handling of nested requirements so that we can delay normalizing them until needed for satisfaction. We currently immediately normalize nested requirements at parse time, where we have the necessary template context, and cache the normal form in their TREE_TYPE node. With this patch, we now delay normalization until needed (as with other constraint expressions), and instead store the current value of current_template_parms in their TREE_TYPE node (which we use to restore the template context at normalization time). In the subsequent patch, this functionality will also be used to normalize placeholder type constraints during auto deduction. gcc/cp/ChangeLog: * constraint.cc (build_parameter_mapping): Rely on the caller to determine the in-scope template parameters. (norm_info::norm_info): Delegate the tsubst_flags_t constructor to the two-parameter constructor. In the two-parameter constructor, fold in the definition of make_context, set initial_parms appropriately, and don't set the now-removed orig_decl member. (norm_info::make_context): Remove, now that its only use is inlined into the caller. (norm_info::update_context): Adjust call to build_parameter_mapping to pass in the relevant set of in-scope template parameters. (norm_info::ctx_parms): Define this member function. (norm_info::context): Initialize to NULL_TREE. (norm_info::orig_decl): Remove this data member. (norm_info::initial_parms): Define this data member. (normalize_atom): Adjust call to build_parameter_mapping to pass in the relevant set of in-scope template parameters. Use info.initial_parms instead of info.orig_decl. (normalize_constraint_expression): Take a norm_info object instead of a bool. Cache the result of normalization. (tsubst_nested_requirement): Call satisfy_constraint_expression instead of satisfy_constraint, so that we normalize on demand. (satisfy_constraint_expression): Handle a NESTED_REQ argument. Adjust call to normalize_constraint_expression. (finish_nested_requirement): Set the TREE_TYPE of the NESTED_REQ to current_template_parms. (diagnose_nested_requirements): Go through satisfy_constraint_expression, as with tsubst_nested_requirement.
…
…
…
…
…
…
…
…
…
…
…
…
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.
Description
Languages
C++
31.9%
C
31.3%
Ada
12%
D
6.5%
Go
6.4%
Other
11.5%