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

            Bug ID: 86369
           Summary: constexpr const char* comparison fails
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linuxfever at yahoo dot gr
  Target Milestone: ---

The following snippet seems to produce contradictory results when comparing
const char* pointers in a constexpr expression:

constexpr auto name1() {
    return "test1";
}

constexpr auto name2() {
    return "test2";
}

int main() {
    constexpr auto b1 = (name1() == name1()); // compiles cleanly
    constexpr auto b2 = (name1() == name2()); // doesn't compile
}

This may be related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71448, but
not sure as the latter is meant to be fixed.

I've tried other GCC versions here and all seem to fail:
https://godbolt.org/g/8KwV2g

Reply via email to