aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-10-13 22:04:53 -0400
committerJason Merrill <jason@redhat.com>2021-10-14 21:40:11 -0400
commit1595fe44e11a969d8ae462212886fb0a87b46226 (patch)
tree597c4fe89c15dd41e714e99532514947bc5add95 /gcc/tree-inline.c
parent5bb1e518b4a5b772665a22cc27245ece5bf82750 (diff)
downloadgcc-1595fe44e11a969d8ae462212886fb0a87b46226.zip
gcc-1595fe44e11a969d8ae462212886fb0a87b46226.tar.gz
gcc-1595fe44e11a969d8ae462212886fb0a87b46226.tar.bz2
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.
Diffstat (limited to 'gcc/tree-inline.c')
0 files changed, 0 insertions, 0 deletions