================ @@ -108,22 +108,16 @@ constexpr auto p2 = "test2"; constexpr bool b1 = foo(p1) == foo(p1); static_assert(b1); -constexpr bool b2 = foo(p1) == foo(p2); // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{comparison of addresses of literals}} \ - // ref-note {{declared here}} -static_assert(!b2); // ref-error {{not an integral constant expression}} \ - // ref-note {{not a constant expression}} +constexpr bool b2 = foo(p1) == foo(p2); +static_assert(!b2); constexpr auto name1() { return "name1"; } constexpr auto name2() { return "name2"; } -constexpr auto b3 = name1() == name1(); -static_assert(b3); -constexpr auto b4 = name1() == name2(); // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{has unspecified value}} \ - // ref-note {{declared here}} -static_assert(!b4); // ref-error {{not an integral constant expression}} \ - // ref-note {{not a constant expression}} +constexpr auto b3 = name1() == name1(); // ref-error {{must be initialized by a constant expression}} \ + // ref-note {{comparison of addresses of literals}} +constexpr auto b4 = name1() == name2(); +static_assert(!b4); ---------------- tbaederr wrote:
Just from looking at these few lines, I don't understand why `b3` warns but `b4` doesn't. They both compare the address of literals. The bytecode interpreter simply creates global variables for string literals, so `b3` here is simply true, like it was in the current interpreter before. Is this behavior wrong now? https://github.com/llvm/llvm-project/pull/109208 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits