[clang] [libcxx] Allow string to use SSO in constant evaluation. (PR #66576)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 06:20:49 PDT 2023


ldionne wrote:

I just want to slide in to say that I *really* like this patch from the point of view of `std::string`'s implementation. Our `__default_init()` method and the `if (is_constant_evaluated())` were pretty awful, and I think it's great to remove them.

I agree it could cause a portability trap to enable this, but I think the right way to go is to have a nice Clang diagnostic that says "oops, strings are can't portably be initialized at compile-time" -- not to make our `std::string` implementation go out of its way to be pessimized at compile-time.

Thanks for working on that @jyknight!

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


More information about the cfe-commits mailing list