Describe the bug
We're having a contiguous iterator whose difference_type is int. STL algorithms then translate it to pointers and back, but doing so they e.g. call the iterator's operator- with a std::ptrdiff_t, not difference_type, like here:
|
return _Dest - (_LastPtr - _FirstPtr);
|
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
Microsoft Visual Studio Professional 2022
Version 17.1.0
Describe the bug
We're having a contiguous iterator whose
difference_typeisint. 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