c++: fix nested instances of modifiable_tracker [PR127282]

PR c++/127282 - [[assume]]: a nested assumption's side effects are not
rolled back during constant evaluation

During constant evaluation of the predicate of an [[assume]] attribute a
pointer to a set of modifiable values is stored in the
constexpr_global_ctx.  The class modifiable_tracker populates this value
when evaluation of the predicate starts and clears it when it is
complete, which results in nullptr instead of the original set when an
[[assume]] is evaluated during the evaluation of the predicate of
another assume.

Fix this by storing the previous value (nullptr in non-nested cases) and
restoring it upon destruction instead of clearing the global value.

	PR c++/127282

gcc/cp/ChangeLog:

	* constexpr.cc (modifiable_tracker::modifiable_tracker): Save the
	current global pointer to the modifiable set.
	(modifiable_tracker::~modifiable_tracker): Restore the original
	pointer to the modifiable set instead of clearing it.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp23/attr-assume10.C: Add a case with a nested assumption.

Signed-off-by: Joshua Berne <berne@notadragon.com>
2 files changed