public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] c++: tolerate cdtors returning this in constexpr
@ 2022-04-07 23:08 Alexandre Oliva
0 siblings, 0 replies; only message in thread
From: Alexandre Oliva @ 2022-04-07 23:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7761bd3d52d97dd9326f168ac02d6f119ca17813
commit 7761bd3d52d97dd9326f168ac02d6f119ca17813
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed Apr 6 15:22:44 2022 -0300
c++: tolerate cdtors returning this in constexpr
On targets that return this from cdtors, cxx_eval_call_expression may
flag flowing off the end of a dtor. That's preempted for ctors, and
avoided entirely when dtors return void, but when they return this,
the return value should be conceptually disregarded, without making
room for such internal ABI details to make a program ill-formed, as in
g++.dg/cpp2a/constexpr-dtor12.C on arm-eabi.
for gcc/cp/ChangeLog
* constexpr.cc (cxx_eval_call_expression): Disregard dtor
result.
Diff:
---
gcc/cp/constexpr.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 9c40b051574..d8bc864ae6b 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -2889,7 +2889,8 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
else
{
result = *ctx->global->values.get (res);
- if (result == NULL_TREE && !*non_constant_p)
+ if (result == NULL_TREE && !*non_constant_p
+ && !DECL_DESTRUCTOR_P (fun))
{
if (!ctx->quiet)
error ("%<constexpr%> call flows off the end "
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-07 23:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-07 23:08 [gcc(refs/users/aoliva/heads/testme)] c++: tolerate cdtors returning this in constexpr Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).