This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/67824] constexpr char* compare operations not constexpr, but char[] operations ARE


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");
                ~~^~~~~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]