This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] span: Fix incorrect return type of span::subspan
ClosedPublic

Authored by miscco on Dec 30 2019, 5:18 AM.

Details

Summary

The extent of the returned span was incorrect

Diff Detail

Event Timeline

miscco created this revision.Dec 30 2019, 5:18 AM
Herald added a project: Restricted Project. · View Herald Transcript
miscco added a comment.Jan 7 2020, 9:36 AM

Gentle ping with the relevant quote from the standard

Ping as this is an actual bugfix

ldionne accepted this revision.Feb 11 2020, 2:57 AM

Thanks for the patch! Good find. I'll commit this with a slight change to the tests. I'll use this formulation of the static_asserts instead, which is clearer IMO:

if constexpr (Count != std::dynamic_extent) {
    static_assert(S1::extent == Count);
} else if constexpr (Span::extent != std::dynamic_extent) {
    static_assert(S1::extent == Span::extent - Offset);
} else {
    static_assert(S1::extent == std::dynamic_extent);
}
This revision is now accepted and ready to land.Feb 11 2020, 2:57 AM
This revision was automatically updated to reflect the committed changes.