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:10:58 +0000	[thread overview]
Message-ID: <bug-86369-4-seChDNhsYL@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

Aaron Ballman <aaron at aaronballman dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aaron at aaronballman dot com

--- Comment #9 from Aaron Ballman <aaron at aaronballman dot com> ---
(In reply to Jason Merrill from comment #8)
> (In reply to Nicolas Lesser from comment #1)
> > For clarity, b1 shouldn't compile.
> > 
> > [lex.string]p16 says: "whether successive evaluations of a string-literal
> > yield the same or a different object is unspecified."
> > 
> > [expr.const]p2 says: "An expression e is a core constant expression unless
> > the evaluation of e, [...], would evaluate one of the following expressions:
> > [...]; a relational or equality operator where the result is unspecified;"
> 
> I think the second quote refers to places in [expr.eq] that say "the result
> is unspecified", not to all instances of unspecified behavior in the
> standard.

Doesn't [expr.eq] make it unspecified though?

[expr.eq]p6 says: "If two operands compare equal, the result is true for the ==
operator and false for the != operator. If two operands compare unequal, the
result is false for the == operator and true for the != operator. Otherwise,
the result of each of the operators is unspecified."

If it is unspecified whether a subsequent string literal evaluation produces
the same object or a different object then it's unspecified whether the two
operands will or won't compare equal, so the result of the operators is also
unspecified.

  parent reply	other threads:[~2022-11-04 13:11 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 [this message]
2022-11-04 13:27 ` jakub at gcc dot gnu.org
2022-11-04 13:53 ` aaron at aaronballman dot com

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-seChDNhsYL@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: link
Be 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).