This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Ready status.
span(R&& r)Section: 23.7.2.2.2 [span.cons] Status: Ready Submitter: Hewill Kang Opened: 2025-10-02 Last modified: 2026-06-09
Priority: 3
View all other issues in [span.cons].
View all issues with Ready status.
Discussion:
It is preferable to reject span<int, 42>(views::empty<int>)
at compile-time after P2280R4, since applying ranges::size on those
ranges is a constant expression now.
[2025-10-20; Reflector poll.]
Set priority to 3 after reflector poll.
The opinions on reflector discussion where split regarding, if this should be considered LEWG matter.
Question was raised, if ranges::size(r) == N is required
to be usable at compile-time for integer-class types.
This wording is relative to N5014.
Modify 23.7.2.2.2 [span.cons] as indicated:
template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);-?- Mandates: If
-16- Constraints: Letextentis not equal todynamic_extentandranges::size(r)is a constant expression, thenranges::size(r) == extentistrue.Uberemove_reference_t<ranges::range_reference_t<R>>. […]
[2026-06-09; Jonathan provides new wording]
Move Mandates: after Constraints: and add more context.
[Brno 2026-06-09; Change status New → Ready]
Proposed resolution:
This wording is relative to N5046.
Modify 23.7.2.2.2 [span.cons] as indicated:
template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);-16- Constraints: Let
Uberemove_reference_t<ranges::range_reference_t<R>>. […]-?- Mandates: If
extentis not equal todynamic_extentandranges::size(r)is a constant expression, thenranges::size(r) == extentistrue.-17- Preconditions: […]
-18- Hardened preconditions: If
extentis not equal todynamic_extent, thenranges::size(r) == extentistrue.