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

Will Hawkins via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 15 12:40:26 PDT 2024


hawkinsw 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):
> 

This is *so* cool. Thank you @H-G-Hristov! I am more than happy to help with benchmarking. I will be able to start work on it tonight -- sorry for the delay!

Will

> 
> ```
> 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)
> # |       |            ^
> ```
> 
> (this feels like a bug) 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