You've already forked llvm-project
mirror of
https://github.com/AdaCore/llvm-project.git
synced 2026-02-12 13:52:35 -08:00
Currently, when the string shrink into the SSO buffer, the `__rep_.__s` member isn't activated before the `traits_type::copy` call yet, so internal `__builtin_memmove` call writing to the buffer causes constant evaluation failure. The existing test coverage seems a bit defective and doesn't cover this case - `shrink_to_fit` is called on the copy of string after erasure, not the original string object. This PR reorders the `__set_short_size` call, which starts the lifetime of the SSO buffer, before the copy operation. Test coverage is achieved by calling `shrink_to_fit` on the original erased string.