Repository navigation
: Add different control block types for allocate_shared_for_overwrite - #4274
Stephan T. Lavavej (StephanTLavavej) merged 6 commits into
Conversation
: Add different control block types for allocator_shared_for_overwrite: Add different control block types for allocate_shared_for_overwrite
|
Do these control blocks need new visualizers? |
I'm now trying to add visualizer for
Edit: Completed these visualizers. However, it's unfortunate that the control blocks for Test program
#include <memory>
#include <memory_resource>
#include <string>
int main() {
// make_shared for arrays of trivial types
{
auto p = std::make_shared<int[8]>();
p[1] = 42;
}
{
auto p = std::make_shared<int[]>(8);
p[1] = 42;
}
{
auto p = std::make_shared_for_overwrite<int[8]>();
p[1] = 42;
}
{
auto p = std::make_shared_for_overwrite<int[]>(8);
p[1] = 42;
}
// make_shared for arrays of non-trivial types
{
auto p = std::make_shared |
|
Thanks! 😻 This investigation, fix, and visualizers must have been a lot of work, I really appreciate it. I pushed a couple of tiny commits and I think this is ready to go. |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for destroying this bug! 🐞 💥 😹 |
allocate_shared_for_overwritecreates allocated non-array objects by default-initialization, so these objects should be destroyed by plain destructor calls, notAtor::destroy. Currently the standard wording is unclear onmake_shared_for_overwriteandallocate_shared_for_overwrite, so I submitted LWG-4024.It's a bit unfortunate that the existing control block types can't be reused because the
_Destroyfunctions can't recognize_For_overwrite_tag.Unblocks one libcxx test:
std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_for_overwrite.pass.cppDrive-by changes: