This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.

3826. Redundant specification [for overload of yield_value]

Section: 25.8.5 [coro.generator.promise] Status: C++23 Submitter: US Opened: 2022-11-10 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [coro.generator.promise].

View all issues with C++23 status.

Discussion:

This is in resolution of US 56-118 (25.8.5 [coro.generator.promise] Redundant specification).

[Paragraph 14] is redundant given [paragraphs] 13 and 12. Remove it.

Paragraphs 12 and 14 are identical: "Remarks: A yield-expression that calls this function has type void (7.6.17 [expr.yield])." Paragraph 13 states that the overload of yield_value that accepts ranges::elements_of for arbitrary ranges has "Effects: Equivalent to:" calling the overload of yield_value that accepts specializations of generator, which paragraph 12 specifies. Per 16.3.2.4 [structure.specifications] paragraph 4, the former overload "inherits" the Remarks of paragraph 12 making paragraph 14 redundant.

LWG is concerned that the redundancy is not immediately obvious — it depends on an understanding of how await expressions function — so we'd like to preserve comment despite that we agree that it is normatively redundant.

[2022-11-10 Casey provides wording]

[Kona 2022-11-11; Move to Immediate]

[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Immediate → WP.]

Proposed resolution:

This wording is relative to N4917.

  1. Modify 25.8.5 [coro.generator.promise] as indicated:

    template<ranges::input_range R, class Alloc>
      requires convertible_to<ranges::range_reference_t<R>, yielded>
        auto yield_value(ranges::elements_of<R, Alloc> r) noexcept;
    

    -13- Effects: Equivalent to: […]

    -14- Remarks: [Note 1: A yield-expression that calls this function has type void (7.6.17 [expr.yield]). end note]