[Bug c++/71448] pointer relational comparison fails inside constant expression
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 8 08:43:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71448
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 38658
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38658&action=edit
gcc7-pr71448.patch
Untested full patch.
That said, I wonder if it is ok that we don't reject clear out of bound
POINTER_PLUS_EXPR in constexprs, like:
static constexpr const char foo[] = "foo";
static constexpr const char *bar = "bar";
static_assert (foo < foo + 30, "check");
static_assert (foo != foo + 30, "check");
static_assert (bar <= bar + 30, "check");
static_assert (bar != bar + 30, "check");
But that is preexisting, the patch doesn't really change anything on that, and
most likely we want to handle this in the FE (if at all).
More information about the Gcc-bugs
mailing list