This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67824] constexpr char* compare operations not constexpr, but char[] operations ARE
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Apr 2016 03:28:55 +0000
- Subject: [Bug c++/67824] constexpr char* compare operations not constexpr, but char[] operations ARE
- Auto-submitted: auto-generated
- References: <bug-67824-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67824
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2015-11-25 00:00:00 |2016-4-26
CC| |msebor at gcc dot gnu.org
Known to fail| |4.9.3, 5.3.0, 6.0
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with all supported versions of GCC, including today's top of trunk:
$ cat z.cpp && /home/msebor/build/gcc-trunk-git/gcc/xgcc
-B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic
-fdump-tree-optimized=/dev/stdout -xc++ z.cpp
constexpr const char s[] = "1234";
constexpr const char* p = "1234";
static_assert (s < s + 1, "This works");
static_assert (p < p + 1, "This fails");
z.cpp:5:1: error: non-constant condition for static assertion
static_assert (p < p + 1, "This fails");
^~~~~~~~~~~~~
z.cpp:5:18: error: â(((const char*)"1234") < (((const char*)"1234") + 1u))â is
not a constant expression
static_assert (p < p + 1, "This fails");
~~^~~~~~~