gcc/libstdc++-v3/testsuite/lib
Jason Merrill 1595fe44e1 c++: instantiate less for constant folding
I've been experimenting with a change to make all inline functions
implicitly constexpr; this revealed that we are instantiating too
aggressively for speculative constant evaluation, leading to ordering
difficulties with e.g. is_a_helper<cgraph_node*>::test.  This patch tries to
avoid such instantiation until we actually need the function definition to
determine whether a call is constant, by limiting the initial instantiation
of all used functions to manifestly-constant-evaluated expressions, and
checking whether the function arguments are constant before instantiating
the function.

This change resulted in a change in the diagnostics for a few library tests
due to instantiating the function with the static_assert later (during
constant evaluation) than we did before (during instantiation of the
intermediate function).

gcc/cp/ChangeLog:

	* constexpr.c (cxx_bind_parameters_in_call): Replace
	new_call parameter with fun.
	(cxx_eval_call_expression): Call it before instantiation.
	(cxx_eval_outermost_constant_expr): Only instantiate fns
	when manifestly_const_eval.
	* typeck2.c (check_narrowing): This context is manifestly
	constant-evaluated.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/integer_comparisons/greater_equal_neg.cc:
	* testsuite/20_util/integer_comparisons/greater_neg.cc:
	* testsuite/20_util/integer_comparisons/less_equal_neg.cc:
	Adjust expected message.
	* testsuite/lib/prune.exp: Prune 'in constexpr expansion'.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/vla22.C: Don't expect a narrowing error.
	* g++.dg/cpp0x/constexpr-inst1.C: New test.
2021-10-14 21:40:11 -04:00
..
dg-options.exp libstdc++: Add testsuite proc for testing deprecated features 2021-08-03 15:30:17 +01:00
gdb-test.exp libstdc++: Fix testsuite for skipping gdb tests on remote/non-native target 2021-08-17 16:54:44 +01:00
libstdc++.exp libstdc++: Avoid illegal argument to verbose in dg-test callback, continued 2021-08-17 21:05:27 +02:00
prune.exp c++: instantiate less for constant folding 2021-10-14 21:40:11 -04:00