Skip to content
Snippets Groups Projects
Commit ac8f92c1 authored by Jason Merrill's avatar Jason Merrill
Browse files

c++: improve failed constexpr assume diagnostic

I noticed that we were printing "the comparison reduces to (x == 42)" when
we should be able to give the value of x.  Fixed by doing the same
evaluation in diagnose_failing_condition that we already do in
find_failing_clause.

gcc/cp/ChangeLog:

	* constexpr.cc (fold_operand): New function.
	(find_failing_clause_r): Add const.
	(find_failing_clause): Add const.
	(diagnose_failing_condition): Add ctx parameter.
	(cxx_eval_internal_function): Pass it.
	* semantics.cc (diagnose_failing_condition): Move to constexpr.cc.
	* cp-tree.h: Adjust.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/attr-assume2.C: Expect constant values.
parent 4ba3902e
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment