Patrick Palka 904ac85775 c++: Distinguish unsatisfaction vs errors during satisfaction [PR97093]
During satisfaction, the flag info.noisy() controls three things:
whether to diagnose ill-formed satisfaction (such as the satisfaction
value of an atom being non-bool or non-constant); whether to diagnose
unsatisfaction; and whether to bypass the satisfaction cache.

The flag turns out to be too coarse however, because in some cases we
want to diagnose ill-formed satisfaction (and bypass the satisfaction
cache) but not diagnose unsatisfaction, for instance when replaying an
erroneous satisfaction result from constraint_satisfaction_value,
evaluate_concept_check and tsubst_nested_requirement.

And when noisily evaluating a disjunction, we want to first evaluate its
branches noisily (bypassing the satisfaction cache) but suppress
unsatisfaction diagnostics.  We currently work around this by instead
first evaluating each branch quietly, but that means the recursive calls
to satisfy_atom will use the satisfaction cache.

To fix this, this patch adds the info.diagnose_unsatisfaction_p() flag,
which refines the info.noisy() flag as part of a new sat_info class that
derives from subst_info.  During satisfaction, info.noisy() now controls
whether to diagnose ill-formed satisfaction, and
info.diagnose_unsatisfaction_p() controls whether to additionally
diagnose unsatisfaction.  This enables us to address the above two
issues straightforwardly.

Incidentally, the change to satisfy_disjunction suppresses the ICE in
the PR97093 testcase because we no longer insert atoms into the
satisfaction cache that have been incorrectly re-normalized in
diagnose_nested_requirement (after losing the necessary template
context).  But the underlying re-normalization issue remains, and will
be fixed in a subsequent patch.

gcc/cp/ChangeLog:

	PR c++/97093
	* constraint.cc (struct sat_info): Define.
	(tsubst_nested_requirement): Pass a sat_info object to
	satisfy_constraint.
	(satisfy_constraint_r): Take a sat_info argument instead of
	subst_info.
	(satisfy_conjunction): Likewise.
	(satisfy_disjunction): Likewise.  Instead of first evaluating
	each branch quietly, evaluate each branch only with
	unsatisfaction diagnostics disabled.  Exit early if evaluation
	of a branch returns error_mark_node.
	(satisfy_atom): Take a sat_info argument instead of subst_info.
	Fix a comment.  Check diagnose_unsatisfaction_p() instead of
	noisy() before replaying a substitution failure.
	(satisfy_constraint): Take a sat_info argument instead of
	subst_info.
	(satisfy_associated_constraints): Likewise.
	(satisfy_constraint_expression): Likewise.
	(satisfy_declaration_constraints): Likewise.
	(constraint_satisfaction_value): Likewise and adjust
	accordingly.  Fix formatting.
	(constraints_satisfied_p): Pass a sat_info object to
	constraint_satisfaction_value.
	(evaluate_concept_check): Pass a sat_info object to
	satisfy_constraint_expression.
	(diagnose_nested_requirement): Likewise.
	(diagnose_constraints): Pass an appropriate sat_info object to
	constraint_satisfaction_value.

gcc/testsuite/ChangeLog:

	PR c++/97093
	* g++.dg/concepts/pr94252.C: Verify we no longer issue a
	spurious unsatisfaction note when diagnosing ill-formed
	satisfaction.
	* g++.dg/cpp2a/concepts-requires18.C: No longer expect a
	spurious unsatisfaction diagnostic when evaluating the
	nested-requirement subst<void&> of a requires-expression that
	appears outside of a template.
	* g++.dg/cpp2a/concepts-requires21.C: Verify we no longer issue
	a spurious unsatisfaction note when evaluating a
	nested-requirement of a requires-expression that appears outside
	of a template.
	* g++.dg/cpp2a/concepts-nonbool3.C: New test.
	* g++.dg/cpp2a/concepts-pr97093.C: New test.
2020-12-05 13:47:22 -05:00
2020-11-26 00:16:41 +00:00
2020-12-05 00:16:39 +00:00
2020-11-19 00:16:30 +00:00
2020-10-30 00:16:29 +00:00
2020-09-25 00:16:27 +00:00
2020-12-02 00:16:41 +00:00
2020-07-31 00:16:26 +00:00
2020-12-04 00:16:36 +00:00
2020-11-26 00:16:41 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-05-30 00:16:27 +00:00
2020-01-15 14:29:53 +01:00
2020-12-02 11:04:01 -07:00
2020-12-03 00:16:47 +00:00

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
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%