[libcxx-commits] [libcxx] [libc++][strings] P2591R5: Concatenation of strings and string views (PR #88389)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 16 02:05:53 PDT 2024


frederick-vs-ja wrote:

> * The second issue is that if I use the paper wording in the code base for the implementation is that I get a compiler error with `constexpr_char_traits` when I concatenate `StringView + String`, so I used the @hawkinsw implementation (Thanks!) more of a workaround rather than optimization in the current iteration (I mean I haven't done any benchmarks yet):

The second issue seems because of that `constexpr_char_traits::move` compares potentially unrelated pointers `s1` and `s2`, which can cause constant evaluation failure when they're unrelated.

https://github.com/llvm/llvm-project/blob/d6d84b5d1448e4f2e24b467a0abcf42fe9d543e9/libcxx/test/support/constexpr_char_traits.h#L100-L118

Error can be generated if we enforce constant evaluation ([Godbolt link](https://godbolt.org/z/eos1qxnPs)). It seems to me that we should fix `constexpr_char_traits::move`.

https://github.com/llvm/llvm-project/pull/88389


More information about the libcxx-commits mailing list