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

4445. sch_ must not be in moved-from state

Section: 33.13.5 [exec.task.scheduler] Status: Immediate Submitter: Tomasz KamiƄski Opened: 2025-11-05 Last modified: 2025-11-05

Priority: Not Prioritized

View other active issues in [exec.task.scheduler].

View all other issues in [exec.task.scheduler].

View all issues with Immediate status.

Discussion:

Addresses US 239-367

As specified, there is an implicit precondition that sch_ is not moved from on all the member functions. If that is intended, the precondition should be made explicit.

[Kona 2025-11-05; approved by LWG. Status changed: New → Immediate.]

Proposed resolution:

This wording is relative to N5014.

  1. Modify 33.13.5 [exec.task.scheduler] as indicated:

    namespace std::execution {
      class task_scheduler {
        class ts-sender;                    // exposition only
    
        template<receiver R>
          class state;                      // exposition only
    
      public:
        using scheduler_concept = scheduler_t;
    
        template<class Sch, class Allocator = allocator<void>>
          requires (!same_as<task_scheduler, remove_cvref_t<Sch>>)
            && scheduler<Sch>
        explicit task_scheduler(Sch&& sch, Allocator alloc = {});
    
        task_scheduler(const task_scheduler&) = default;
        task_scheduler& operator=(const task_scheduler&) = default;
    
        ts-sender schedule();
    
        friend bool operator==(const task_scheduler& lhs, const task_scheduler& rhs)
            noexcept;
        template<class Sch>
          requires (!same_as<task_scheduler, Sch>)
          && scheduler<Sch>
        friend bool operator==(const task_scheduler& lhs, const Sch& rhs) noexcept;
    
      private:
        shared_ptr<void> sch_; // exposition only
      };
    }