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

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 15 03:28:13 PDT 2024


H-G-Hristov wrote:

@mordante @frederick-vs-ja Thank you for the feedback.
I have encountered two issues. Adding another step of indirection to the tests causes *constexpr evaluation hit maximum step limit; possible infinite loop*. I haven't seen this before, so I refactored the tests to use one less step:

```
Projects/llvm-project/build/default.debug.libcxx/include/c++/v1/__memory/compressed_pair.h:142:5: note: constexpr evaluation hit maximum step limit; possible infinite loop?
# |   142 |     return static_cast<_Base2 const&>(*this).__get();
```
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):

```
constexpr_char_traits.h:105:12: note: comparison between '&__r.__r_.__compressed_pair_elem::__value_.__compressed_pair_elem::union (anonymous union at /include/c++/v1/string:867:5).__compressed_pair_elem::__s.__compressed_pair_elem::__data_[0]' and '&"short"[0]' has unspecified value
# |   105 |     if (s1 < s2)
# |       |            ^
```
which is even odder I am not able to reproduce the same behavior on [compiler explorer
](https://godbolt.org/z/G86c3E4cj)

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


More information about the libcxx-commits mailing list