Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@0x8000-0000
Copy link
Contributor

Fixes #1747

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

size_t new_size = size_ + to_unsigned(end - begin);
reserve(new_size);
std::uninitialized_copy(begin, end, make_checked(ptr_, capacity_) + size_);
std::uninitialized_copy(begin, end, make_checked(ptr_ + size_, capacity_));
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. I think you also need to subtract size_ from capacity_.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, but why do all the test pass? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Because we don't write over capacity. The whole checked iterator machinery in MSVC is completely useless and is here mostly to avoid warnings but let's provide correct bounds anyway.

@0x8000-0000 0x8000-0000 force-pushed the fix-conversion-warning branch from 8f7bdbf to cdbbe00 Compare July 3, 2020 01:27
@vitaut vitaut merged commit 31ce6bc into fmtlib:master Jul 3, 2020
@vitaut
Copy link
Contributor

vitaut commented Jul 3, 2020

Thank you!

@0x8000-0000 0x8000-0000 deleted the fix-conversion-warning branch July 7, 2020 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Wsign-conversion warning with Clang10 on Windows

2 participants