Skip to content

Conversation

@StephanTLavavej
Copy link
Member

Found by std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_for_overwrite.pass.cpp in the upcoming libcxx update.

memory(2858): warning C4267: 'argument': conversion from 'size_t' to 'test_allocator<U>::size_type', possible loss of data

We need to _Convert_size when allocating, but if that succeeds, we can simply static_cast when deallocating.

std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_for_overwrite.pass.cpp

memory(2858): warning C4267: 'argument': conversion from 'size_t' to 'test_allocator<U>::size_type', possible loss of data

We need to `_Convert_size` when allocating, but if that succeeds, we can simply `static_cast` when deallocating.
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Dec 10, 2023
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner December 10, 2023 07:40
@StephanTLavavej StephanTLavavej self-assigned this Dec 14, 2023
@StephanTLavavej
Copy link
Member Author

StephanTLavavej commented Dec 14, 2023

I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 7276976 into microsoft:main Dec 14, 2023
@StephanTLavavej StephanTLavavej deleted the allocate_shared-truncation-warnings branch December 14, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants