KEMBAR78
Implement LWG-4242 `ranges::distance` does not work with volatile iterators by frederick-vs-ja · Pull Request #5603 · microsoft/STL · GitHub
Skip to content

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Jun 21, 2025

Per LWG-4242/WG21-P3742R0 (alternative link).

Fixes #5623.

This PR makes the involved overload of ranges::distance more constrained than explicitly written, because the "Effects: Equivalent to:" in [range.iter.op.distance]/3 isn't changed and we should propagate the implicit constraints per [structure.specifications]/4.

Drive-by change:

  • Removes the skipping for VSO-1898890 (EDGcpfe/26576 EDG produces an error for conversion from array to const reference to pointer) because ranges::distance no longer performs such a conversion.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner June 21, 2025 13:48
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Jun 21, 2025
@github-project-automation github-project-automation bot moved this from Initial Review to Work In Progress in STL Code Reviews Jul 23, 2025
@StephanTLavavej StephanTLavavej removed their assignment Jul 23, 2025
@StephanTLavavej StephanTLavavej moved this from Work In Progress to Initial Review in STL Code Reviews Jul 24, 2025
@StephanTLavavej StephanTLavavej self-assigned this Jul 24, 2025
@StephanTLavavej StephanTLavavej removed their assignment Aug 6, 2025
@StephanTLavavej
Copy link
Member

Thanks for filing LWG-4303. This makes it a lot easier to see that the implementation is following what the Standard says, plus a proposed resolution. 😻

@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Aug 6, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Aug 7, 2025
@StephanTLavavej
Copy link
Member

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

@StephanTLavavej StephanTLavavej merged commit 9ed9371 into microsoft:main Aug 8, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Aug 8, 2025
@StephanTLavavej
Copy link
Member

Thanks for handling this highly volatile issue! 🧪 🧑‍🔬 💥

@frederick-vs-ja frederick-vs-ja deleted the lwg-4242 branch August 8, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LWG Library Working Group issue ranges C++20/23 ranges

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

LWG-4242 ranges::distance does not work with volatile iterators

3 participants