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