public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aaron at aaronballman dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/86369] constexpr const char* comparison fails Date: Fri, 04 Nov 2022 13:53:30 +0000 [thread overview] Message-ID: <bug-86369-4-AJ2KrTk6Kd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-86369-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86369 --- Comment #11 from Aaron Ballman <aaron at aaronballman dot com> --- (In reply to Jakub Jelinek from comment #10) > (In reply to Aaron Ballman from comment #9) > > Doesn't [expr.eq] make it unspecified though? > > Will defer that answer to Jason. > But please have a look at the comment 6 testcase. I strongly hope that > constexpr const char *p = "abc"; > constexpr const char *q = p; > static_assert (p == q, ""); > doesn't actually mean the string literal is evaluated multiple times, because > if it would be, then one pretty much can't use string literals for anything > reliably. Oh yeah, I agree with you in that case. I was talking about the summary example with function calls returning a string literal. Sorry for not being more clear! > I bet the wording in there is for the > constexpr const char *r = "abc"; > constexpr const char *s = "abc"; > case, where the standard doesn't force implementations to unify same string > literals within the same TU but allows it (and also allows say tail merging > of them). From what I can see in the LLVM constant expression evaluation > behavior, it doesn't track what comes from which evaluation of a string > literal (GCC doesn't track that either) and just assumes that it could be > different evaluation, while GCC assumes it is not. Yeah, that sounds plausible.
prev parent reply other threads:[~2022-11-04 13:53 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-86369-4@http.gcc.gnu.org/bugzilla/> 2021-08-05 4:43 ` pinskia at gcc dot gnu.org 2021-08-05 15:24 ` redi at gcc dot gnu.org 2021-08-05 15:30 ` jakub at gcc dot gnu.org 2021-08-05 18:09 ` jakub at gcc dot gnu.org 2021-08-06 7:27 ` rguenth at gcc dot gnu.org 2022-01-18 13:18 ` jason at gcc dot gnu.org 2022-11-04 13:10 ` aaron at aaronballman dot com 2022-11-04 13:27 ` jakub at gcc dot gnu.org 2022-11-04 13:53 ` aaron at aaronballman dot com [this message]
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-86369-4-AJ2KrTk6Kd@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).