c++: Nondeterministic concepts diagnostics [PR94830]
authorPatrick Palka <ppalka@redhat.com>
Wed, 29 Apr 2020 13:04:58 +0000 (09:04 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 29 Apr 2020 13:06:24 +0000 (09:06 -0400)
commita7201a085cc30f89944931d8fb1d7936f02a169f
tree9750ea9e5fb0d2340797252b21442d7029fc973a
parent3bce790414afaaba10e03f7bb41e4aa3279694f5
c++: Nondeterministic concepts diagnostics [PR94830]

This patch makes the order in which template parameters appear in the
TREE_LIST returned by find_template_parameters deterministic between
runs.

The current nondeterminism is semantically harmless, but it has the
undesirable effect of causing some concepts diagnostics which print a
constraint's parameter mapping via pp_cxx_parameter_mapping to also be
nondeterministic, as in the testcases below.

gcc/cp/ChangeLog:

PR c++/94830
* pt.c (find_template_parameter_info::parm_list): New field.
(keep_template_parm): Use the new field to build up the
parameter list here instead of ...
(find_template_parameters): ... here.  Return ftpi.parm_list.

gcc/testsuite/ChangeLog:

PR c++/94830
* g++.dg/concepts/diagnostics12.C: Clarify the dg-message now
that the corresponding diagnostic is deterministic.
* g++.dg/concepts/diagnostics13.C: New test.
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/concepts/diagnostic12.C
gcc/testsuite/g++.dg/concepts/diagnostic13.C [new file with mode: 0644]