Skip to content

[mdspan.sub.helpers] Fix swapped offset/extent in canonical-slice#9139

Merged
jensmaurer merged 1 commit into
cplusplus:mainfrom
abhinavagarwal07:fix-canonical-slice-extent-swap
Jun 16, 2026
Merged

[mdspan.sub.helpers] Fix swapped offset/extent in canonical-slice#9139
jensmaurer merged 1 commit into
cplusplus:mainfrom
abhinavagarwal07:fix-canonical-slice-extent-swap

Conversation

@abhinavagarwal07

Copy link
Copy Markdown
Contributor

The extent_slice branch of canonical-slice ([mdspan.sub.helpers]) initializes .offset from s.extent and .extent from s.offset, reversing the intended mapping. This is inconsistent with canonical-range-slice and the pre-P3982R2 wording, both of which map offset → offset and extent → extent.

The extent_slice branch of canonical-slice initializes .offset from
s.extent and .extent from s.offset, reversing the intended mapping.
This is inconsistent with canonical-range-slice and the pre-P3982R2
wording, both of which map offset → offset and extent → extent.
@eisenwave

Copy link
Copy Markdown
Member

I'm not sure whether this is editorial. https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p3982r2.html does have this problem.

Does this require an LWG issue or can we treat this as an obvious typo @jwakely

@eisenwave eisenwave added the P1-Important Misapplication of paper, malformed code, internal inconsistencies label Jun 16, 2026
@abhinavagarwal07

Copy link
Copy Markdown
Contributor Author

Happy to file LWG if its more appropriate.

@jwakely

jwakely commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problems with the presentation of the specification, which, when fixed, would not alter the (intended) meaning of the specification. Typos and obvious inconsistencies fall into this category.

https://github.com/cplusplus/draft/wiki/How-to-tell-if-an-issue-is-editorial

This seems clearly editorial, the intended meaning is to initialize the offset with the offset and the extent with the extent.

@tkoeppe tkoeppe requested a review from jwakely June 16, 2026 16:54
@jensmaurer jensmaurer merged commit 2baf431 into cplusplus:main Jun 16, 2026
2 checks passed
@tomaszkam

Copy link
Copy Markdown

That was a typo, libstdc++ implementation implemented the PR: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/std/mdspan;h=f5556f35fa1497f2bbd1c4debd822841ec5f05c3;hb=HEAD#l3356. That was intent from the start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1-Important Misapplication of paper, malformed code, internal inconsistencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants