[llvm-bugs] [Bug 38013] New: constexpr const char* comparison error

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 2 04:27:44 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38013

            Bug ID: 38013
           Summary: constexpr const char* comparison error
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: linuxfever at yahoo.gr
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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
}

Apparently (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86369), neither should
compile. Live code here: https://godbolt.org/g/8W4VrS

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180702/5e2b91bc/attachment.html>


More information about the llvm-bugs mailing list