public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105440] c++20: std::string's destructor not a constant expression when it should Date: Mon, 17 Apr 2023 14:27:16 +0000 [thread overview] Message-ID: <bug-105440-4-35aPOOXeou@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105440-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105440 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> --- Seems this is ultimately an FE bug which is fixed by: diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index d1097764b10..9dbbf6eec03 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -3213,7 +3213,12 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, && CLASS_TYPE_P (TREE_TYPE (res)) && !is_empty_class (TREE_TYPE (res))) if (replace_decl (&result, res, ctx->object)) - cacheable = false; + { + cacheable = false; + result = cxx_eval_constant_expression (ctx, result, lval, + non_constant_p, + overflow_p); + } } else /* Couldn't get a function copy to evaluate. */ In some cases we can simplify a call result further after replacing RESULT_DECL with the current object under construction throughout the call result, which allows fold_binary_loc etc to later successfully fold comparisons involving the call result such as _M_data() == _M_local_data() in this case.
next prev parent reply other threads:[~2023-04-17 14:27 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-30 13:28 [Bug libstdc++/105440] New: " janpmoeller at gmx dot de 2022-05-04 16:16 ` [Bug libstdc++/105440] " redi at gcc dot gnu.org 2023-04-17 14:27 ` ppalka at gcc dot gnu.org [this message] 2023-05-08 12:24 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105440-4-35aPOOXeou@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).