Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement LWG-3471: polymorphic_allocator::allocate does not satisfy Cpp17Allocator requirements #2567

Merged
merged 3 commits into from
Feb 18, 2022

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Feb 14, 2022

Fixes #2550

I saw that the changes were in "Previous resolution [SUPERSEDED]" but as far as I understand the new resolution is needed because of changing the wording and the proposed implementation stays the same.

std::launder is in <new>

<xmemory> includes <new>

<xpolymorphic_allocator.h> includes <xmemory>

@fsb4000 fsb4000 requested a review from a team as a code owner February 14, 2022 07:07
@timsong-cpp
Copy link
Contributor

timsong-cpp commented Feb 14, 2022

The original wording is incorrect (and the launder has no effect - laundering a pointer to byte that is already pointing to a live std::byte accomplishes precisely nothing).

The intended implementation (taking advantage of [intro.object]/13) is

    return ::operator new(_Bytes, _Ptr);

Co-authored-by: timsong-cpp <rs2740@gmail.com>
@CaseyCarter CaseyCarter added the LWG Library Working Group issue label Feb 14, 2022
Copy link
Member

@CaseyCarter CaseyCarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't imagine how we would test for this, so I won't ask for test coverage.

@StephanTLavavej StephanTLavavej self-assigned this Feb 17, 2022
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. (I'll handle verifying that this works with the recent LLVM update.)

StephanTLavavej added a commit to StephanTLavavej/STL that referenced this pull request Feb 17, 2022
@StephanTLavavej StephanTLavavej merged commit b92f2c8 into microsoft:main Feb 18, 2022
@StephanTLavavej
Copy link
Member

Thanks for implementing another LWG issue resolution! ✅ 💯 🎉

@fsb4000 fsb4000 deleted the fix2550 branch February 18, 2022 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LWG Library Working Group issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWG-3471 polymorphic_allocator::allocate does not satisfy Cpp17Allocator requirements
5 participants
  翻译: