[promises] Generate a better error message for a common mistake (#35191)

Closes #35191

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35191 from ctiller:cg-promise-like-fix 0683ffe169
PiperOrigin-RevId: 587026178
pull/35138/head
Craig Tiller 1 year ago committed by Copybara-Service
parent 6e18346c96
commit e481f6acc5
  1. 4
      src/core/lib/promise/detail/promise_like.h

@ -68,6 +68,10 @@ class PromiseLike {
private:
GPR_NO_UNIQUE_ADDRESS F f_;
static_assert(!std::is_void<typename std::result_of<F()>::type>::value,
"PromiseLike cannot be used with a function that returns void "
"- return Empty{} instead");
public:
// NOLINTNEXTLINE - internal detail that drastically simplifies calling code.
PromiseLike(F&& f) : f_(std::forward<F>(f)) {}

Loading…
Cancel
Save