-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<algorithm>
/<iterator>
: contiguous iterators with non-ptrdiff_t
difference types
#3663
Comments
<algorithm>
/<iterator>
: contiguous iterators with non-ptrdiff_t
difference types
The issue occurs with Line 4636 in 3c1f3d7
Although I think the |
We still run into this problem with std::copy_n: https://godbolt.org/z/Gvq7Pfr7E |
@foonathan - Please open a new bug; commenting on closed bugs is hard to keep track of. |
It seems that the "latest" version used by Godbolt is currently 17.11.x, while the bugfix was merged for 17.12 Preview 3. So perhaps you need to update VS to get the bugfix at this moment. |
Fixed by #5046. |
Describe the bug
We're having a contiguous iterator whose
difference_type
isint
. STL algorithms then translate it to pointers and back, but doing so they e.g. call the iterator's operator- with astd::ptrdiff_t
, notdifference_type
, like here:STL/stl/inc/xutility
Line 4944 in 3c1f3d7
This causes a truncation warning.
Command-line test case
https://godbolt.org/z/YbojbWPMd
Expected behavior
No warning should happen, the implementation should cast to the appropriate difference type before invoking the operator.
STL version
The text was updated successfully, but these errors were encountered: