Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Interaction with passing lvalue to set_value when sender sends a value

Đang mở
#1,065 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
cpp
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Tái hiện chẩn đoán bằng lệnh gcc-13 được báo cáo và tệp mẫu set_value.cpp, sau đó kiểm tra khu vực xung quanh việc kiểm tra completion-signature trong stdexec/include/stdexec/execution.hpp. Xác định cách xử lý dự kiến đối với một lvalue được truyền vào set_value khi sender khai báo set_value_t(int), và bổ sung coverage thể hiện hành vi đã thống nhất.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In the sample code below, compiling with gcc-13 ( g++-13 -std=c++20 set_value.cpp -I stdexec/include -c), my bespoke sender claims it completes with set_value_t(int), although the implementation ends up sending an lvalue v, an int declared on the stack.

#include <stdexec/execution.hpp>
#include <exec/finally.hpp>

struct StdexecSender {

  using is_sender = void;

  template <class Receiver>
  struct Operation {
    Receiver r;

    friend auto tag_invoke(stdexec::start_t, Operation& self) noexcept {
      int v = 0;
      stdexec::set_value((Receiver&&)self.r, v);
    };
  };

  template <class Self, class Receiver>
      requires (std::same_as<StdexecSender, std::remove_cv_t<Self>>)
  friend auto tag_invoke(stdexec::connect_t, Self&& self, Receiver&& r) {
    return Operation<std::decay_t<Receiver>>(std::forward<Receiver>(r));
  }

  using completion_signatures = stdexec::completion_signatures<stdexec::set_value_t(int)>;

};
static_assert(stdexec::sender<StdexecSender>);

void foo() {
    stdexec::sync_wait(exec::finally(stdexec::let_value(StdexecSender{}, [](auto&&...) { return StdexecSender{}; }), stdexec::just()));
}

I get the following diagnostic.

./stdexec/include/exec/../stdexec/execution.hpp:1010:38: warning: 'void stdexec::__debug::_ATTENTION_() [with _Warning = stdexec::_WARNING_<_COMPLETION_SIGNATURES_MISMATCH_, _COMPLETION_SIGNATURE_<stdexec::__receivers::set_value_t(int&)>, _IS_NOT_ONE_OF_<stdexec::__receivers::set_error_t(std::__exception_ptr::exception_ptr), stdexec::__receivers::set_value_t(int)>, _SIGNAL_SENT_BY_SENDER_<stdexec::__let::__sender<stdexec::_Yp<StdexecSender>, main()::<lambda(auto:86&& ...)>, stdexec::__let::let_value_t> > >]' is deprecated: The sender claims to send a particular set of completions, but in actual fact it completes with a result that is not one of the declared completion signatures. [-Wdeprecated-declarations]

The key part is

The sender claims to send a particular set of completions, but in actual fact it completes with a result that is not one of the declared completion signatures.

This makes sense given that technically, I should be sending std::move(v) or something of that nature. That said, the lvalue v is convertible to a plain value (I'm not sure what the type category is called here). My understanding is that set_value is akin to returning from a function. A function declared returning int can write return v - should I be able to write set_value(v) here?

Ngôn ngữ chính
C++
Star
2.4k
Fork
270
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
37

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/stdexec

Tất cả issue của NVIDIA/stdexec

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.