Commit 479f992
authored
[libc++] Fix
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.basic_string::shrink_to_fit for constant evaluation (#142712)1 parent bac4aa4 commit 479f992
File tree
2 files changed
+2
-2
lines changed- libcxx
- include
- test/std/strings/basic.string/string.capacity
2 files changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3434 | 3434 | | |
3435 | 3435 | | |
3436 | 3436 | | |
3437 | | - | |
3438 | 3437 | | |
| 3438 | + | |
3439 | 3439 | | |
3440 | 3440 | | |
3441 | 3441 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
0 commit comments