Section: 26.2 [ranges.syn], 26.3.14 [range.prim.cdata] Status: WP Submitter: Jiang An Opened: 2023-06-20 Last modified: 2023-11-22 16:02:17 UTC
Priority: Not Prioritized
View other active issues in [ranges.syn].
View all other issues in [ranges.syn].
View all issues with WP status.
Discussion:
As of P2278R4, several range access CPOs are specified with possibly-const-range and as-const-pointer. These helper functions never throw exceptions, but are not marked with noexcept. As a result, implementations are currently allowed to make a call to ranges::ccpo potentially throwing while the underlying ranges::cpo call is non-throwing, which doesn't seem to be intended.
[2023-10-27; Reflector poll]
Set status to Tentatively Ready after five votes in favour during reflector poll.
[2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4950.
Modify 26.2 [ranges.syn], header <ranges> synopsis, as indicated:
[…] // 26.7.21 [range.as.const], as const view template<input_range R> constexpr auto& possibly-const-range(R& r) noexcept { // exposition only if constexpr (constant_range<const R> && !constant_range<R>) { return const_cast<const R&>(r); } else { return r; } } […]
Modify 26.3.14 [range.prim.cdata] before p1 as indicated:
template<class T> constexpr auto as-const-pointer(const T* p) noexcept { return p; } // exposition only