[llvm] [llvm] Fix string and Twine concatenation for C++26 P2591R5 (PR #227959)
Aaron Ballman via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 04:45:21 PDT 2026
AaronBallman wrote:
> I accept that this solves the problem we're facing, but I can't help but feel that there might be a better way of solving it that doesn't require changing every call site and I think we should look at what we can do to make that possible. Since adding another overload doesn't help as you've previously stated, how much churn does removing the `StringRef` to `std::string_view` conversion cause? Presumably this would remove the ambiguity, because then the new `operator+` added by the standard will not be compatible with `StringRef + std::string`. Assuming this does actually work with minimal churn, it would be worth a wider discussion to decide if this is the right thing to do or not. If it doesn't work, what other options do we have?
I think this is worth exploring; one of the benefits of `Twine` is that you generally don't have to explicitly construct it when concatenating objects of different string types; I feel like (at least within Clang) there's more reliance on that pattern than there is on use of `std::string_view` but I don't know that for sure. However, I also am not opposed to the current PR as-is.
https://github.com/llvm/llvm-project/pull/227959
More information about the llvm-commits
mailing list