public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kariya_mitsuru at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65509] [5 Regression] [C++11] GCC rejects operator== with two distinct pointers as not constexpr
Date: Sat, 28 Mar 2015 18:24:00 -0000	[thread overview]
Message-ID: <bug-65509-4-uFbSonn9g6@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65509-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65509

--- Comment #14 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> ---
The rev.221737 seems to be able to compile the sample code above, but cannot
compile another sample code like below.

================= sample code =================
constexpr char s1[] = "s1";
constexpr char s2[] = "s2";

constexpr auto eq = (s1 + 0) == (s2 + 1);

int main() {}
================= sample code =================
================ error message ================
compare2.cpp:4:30: error: '(((const char*)(& s1)) == (((const char*)(& s2)) +
1u))' is not a constant expression
 constexpr auto eq = (s1 + 0) == (s2 + 1);
================ error message ================

Although the first sample causes compilation error only in 5.0.0, the second
sample causes compilation error in 4.9.2 too.

cf. http://melpon.org/wandbox/permlink/KhcREuNqGofbZvqw


  parent reply	other threads:[~2015-03-28 15:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-22  9:55 [Bug c++/65509] New: " kariya_mitsuru at hotmail dot com
2015-03-22 10:38 ` [Bug c++/65509] " daniel.kruegler at googlemail dot com
2015-03-22 12:55 ` mpolacek at gcc dot gnu.org
2015-03-25  8:54 ` [Bug c++/65509] [5 Regression] " mpolacek at gcc dot gnu.org
2015-03-25  9:04 ` jakub at gcc dot gnu.org
2015-03-25 10:07 ` jakub at gcc dot gnu.org
2015-03-25 11:45 ` jakub at gcc dot gnu.org
2015-03-25 12:42 ` daniel.kruegler at googlemail dot com
2015-03-25 14:44 ` mpolacek at gcc dot gnu.org
2015-03-25 15:07 ` mpolacek at gcc dot gnu.org
2015-03-25 15:35 ` jakub at gcc dot gnu.org
2015-03-25 15:39 ` mpolacek at gcc dot gnu.org
2015-03-27 16:37 ` jason at gcc dot gnu.org
2015-03-27 16:54 ` jason at gcc dot gnu.org
2015-03-27 16:54 ` jason at gcc dot gnu.org
2015-03-28 18:24 ` kariya_mitsuru at hotmail dot com [this message]
2015-03-28 18:31 ` kariya_mitsuru at hotmail dot com
2015-03-29 19:29 ` jason 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-65509-4-uFbSonn9g6@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).