================ @@ -119,6 +119,15 @@ constexpr auto b3 = name1() == name1(); // ref-error {{must be initialized by a constexpr auto b4 = name1() == name2(); static_assert(!b4); +constexpr auto bar(const char *p) { return p + __builtin_strlen(p); } +constexpr auto b5 = bar(p1) == p1; +static_assert(!b5); +constexpr auto b6 = bar(p1) == ""; // ref-error {{must be initialized by a constant expression}} \ + // ref-note {{comparison of addresses of potentially overlapping literals}} +constexpr auto b7 = bar(p1) + 1 == ""; // both-error {{must be initialized by a constant expression}} \ + // ref-note {{comparison against pointer '&"test1"[6]' that points past the end of a complete object has unspecified value}} \ + // expected-note {{comparison against pointer '&"test1"[6] + 1' that points past the end of a complete object has unspecified value}} ---------------- hnrklssn wrote:
Hmm I may have been to quick with this, CI reports differently now. Reverting to check. https://github.com/llvm/llvm-project/pull/137078 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits