Use satisfaction with nested requirements

Programming / Compilers / GCC - jason [138bc75d-0d04-0410-961f-82ee72b054a4] - 7 November 2019 00:21 EST

gcc/cp/

2019-11-06 Andrew Sutton

- constraint.cc (build_parameter_mapping): Use current_template_parms when the declaration is not available. (norm_info::norm_info) Make explicit. (normalize_constraint_expression): Factor into a separate overload that takes arguments, and use that in the original function. (tsubst_nested_requirement): Use satisfy_constraint instead of trying to evaluate this as a constant expression. (finish_nested_requirement): Keep the normalized constraint and the original normalization arguments with the requirement. (diagnose_nested_requirement): Use satisfy_constraint. Tentatively implement more comprehensive diagnostics, but do not enable.
- parser.c (cp_parser_requires_expression): Relax requirement that requires-expressions can live only inside templates.
- pt.c (any_template_parm_r): Look into type of PARM_DECL.

2019-11-06 Jason Merrill

- pt.c (use_pack_expansion_extra_args_p): Still do substitution if all packs are simple pack expansions. (add_extra_args): Check that the extra args aren't dependent.

gcc/testsuite/
- lib/prune.exp: Ignore "in requirements" in diagnostics.
- g++.dg/cpp2a/requires-18.C: New test.
- g++.dg/cpp2a/requires-19.C: New test.

8d0cec732f4 Use satisfaction with nested requirements.
gcc/cp/ChangeLog | 24 ++++++
gcc/cp/constraint.cc | 100 +++++++++++++----------
gcc/cp/parser.c | 11 ---
gcc/cp/pt.c | 42 +++++++++-
gcc/testsuite/g++.dg/cpp2a/concepts-requires18.C | 77 +++++++++++++++++
gcc/testsuite/g++.dg/cpp2a/concepts-requires19.C | 58 +++++++++++++
gcc/testsuite/lib/prune.exp | 1 +
7 files changed, 256 insertions(+), 57 deletions(-)

Upstream: gcc.gnu.org


  • Share