diff options
author | Jason Merrill <jason@redhat.com> | 2020-10-28 17:30:05 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-10-29 13:09:19 -0400 |
commit | 8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7 (patch) | |
tree | 86d08ca2e07ec9650266b97e5c53b6eea03c3511 /gcc/tree-vect-loop.c | |
parent | 5afd90c5f36bf45291ca09ef3791f4a574e90d5d (diff) | |
download | gcc-8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7.zip gcc-8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7.tar.gz gcc-8895443a42db4045aad8e4b42cd5dd2ad6ffa7d7.tar.bz2 |
c++: Fix constexpr cleanup error handling.
In this testcase, the primary evaluation successfully produces 'true', and
then running one of the cleanups hits a double delete, making the whole
thing not a valid constant expression. So we were returning 'true' wrapped
in a NOP_EXPR to indicate its non-constancy, but evaluating that again is a
perfectly acceptable constant expression, so we weren't getting the verbose
diagnostic we were looking for.
So if non_constant_p gets set other than for overflow, go back to the
original expression.
With this change, we should never hit the manifestly_const_eval test, and
the is-constant-evaluated1.C test passes without it.
gcc/cp/ChangeLog:
PR c++/97388
* constexpr.c (cxx_eval_outermost_constant_expr): Revert to
original expression if evaluation sets non_constant_p.
gcc/testsuite/ChangeLog:
PR c++/97388
* g++.dg/cpp2a/constexpr-dtor8.C: New test.
Diffstat (limited to 'gcc/tree-vect-loop.c')
0 files changed, 0 insertions, 0 deletions