Skip to content

Commit 54e7a37

Browse files
committed
try making co_return strict
1 parent f194d34 commit 54e7a37

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

include/seastar/core/coroutine.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public:
5151

5252
template<typename... U>
5353
void return_value(U&&... value) {
54-
_promise.set_value(std::forward<U>(value)...);
54+
_promise.set_value(non_explicit_tag{}, std::forward<U>(value)...);
5555
}
5656

5757
void return_value(coroutine::exception ce) noexcept {

include/seastar/core/future.hh

+11
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ struct get0_return_type {
282282
template<typename T>
283283
using maybe_wrap_ref = std::conditional_t<std::is_reference_v<T>, std::reference_wrapper<std::remove_reference_t<T>>, T>;
284284

285+
struct non_explicit_tag{};
286+
287+
285288
/// \brief Wrapper for keeping uninitialized values of non default constructible types.
286289
///
287290
/// This is similar to a std::optional<T>, but it doesn't know if it is holding a value or not, so the user is
@@ -302,8 +305,16 @@ struct uninitialized_wrapper_base<T, false> {
302305
maybe_wrap_ref<T> value;
303306
} _v;
304307

308+
template<typename U>
309+
static T make_implicitly(U&& v) {
310+
return std::forward<U>(v);
311+
}
305312
public:
306313
uninitialized_wrapper_base() noexcept = default;
314+
template<typename U>
315+
void uninitialized_set(non_explicit_tag, U&& v) {
316+
new (&_v.value) maybe_wrap_ref<T>(make_implicitly(std::forward<U>(v)));
317+
}
307318
template<typename... U>
308319
std::enable_if_t<!std::is_same_v<std::tuple<std::remove_cv_t<U>...>, std::tuple<tuple_type>>, void>
309320
uninitialized_set(U&&... vs) {

0 commit comments

Comments
 (0)