[libcxx-commits] [PATCH] D117332: [libc++] Make sure basic_string::reserve never shrinks in all standard modes
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 14 09:47:26 PST 2022
ldionne created this revision.
ldionne added reviewers: rsmith, Quuxplusone.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Since basic_string::reserve is instantiated in the shared library but also
available to the compiler for inlining, its definition should not depend on
things like the Standard mode in use. Indeed, that flag may not match between
how the shared library is compiled and how users are compiling their own code,
resulting in ODR violations.
A valid implementation of `reserve()` has always been to never shrink,
even before C++20. This patch uses that implementation freedom to resolve
the issue by always implementing the C++20 behavior.
Fixes llvm-project#53170
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117332
Files:
libcxx/docs/ReleaseNotes.rst
libcxx/include/string
libcxx/test/libcxx/strings/basic.string/string.capacity/PR53170.pass.cpp
libcxx/test/libcxx/strings/basic.string/string.capacity/reserve.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117332.400053.patch
Type: text/x-patch
Size: 5760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220114/5b6245e7/attachment.bin>
More information about the libcxx-commits
mailing list