Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc383f24

Browse files
authored
Merge pull request#791 from NVIDIA/mandate-noexcept-start
static_assert in start() when customization is not nothrow
2 parentsbb9b899 +7995c3c commitc383f24

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

‎include/stdexec/execution.hpp‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,8 @@ namespace stdexec {
12191219
structstart_t {
12201220
template<class_Op>
12211221
requires tag_invocable<start_t, _Op&>
1222-
voidoperator()(_Op& __op)constnoexcept(nothrow_tag_invocable<start_t, _Op&>) {
1222+
voidoperator()(_Op& __op)constnoexcept {
1223+
static_assert(nothrow_tag_invocable<start_t, _Op&>);
12231224
(void)tag_invoke(start_t{}, __op);
12241225
}
12251226
};
@@ -1230,10 +1231,13 @@ namespace stdexec {
12301231

12311232
/////////////////////////////////////////////////////////////////////////////
12321233
// [execution.op_state]
1233-
template<class_O>
1234-
conceptoperation_state = destructible<_O> && std::is_object_v<_O> &&requires(_O& __o) {
1235-
{start(__o) }noexcept;
1236-
};
1234+
template<class_Op>
1235+
conceptoperation_state =//
1236+
destructible<_Op> &&//
1237+
std::is_object_v<_Op> &&//
1238+
requires(_Op& __op) {//
1239+
start(__op);
1240+
};
12371241

12381242
#if !_STD_NO_COROUTINES_
12391243
/////////////////////////////////////////////////////////////////////////////

‎test/stdexec/concepts/test_concept_operation_state.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ struct op_noexcept {
3535
}
3636
};
3737

38-
TEST_CASE(
39-
"type with start CPO that throws is not an operation_state",
40-
"[concepts][operation_state]") {
41-
REQUIRE(!ex::operation_state<op_except>);
42-
}
38+
//TEST_CASE(
39+
// "type with start CPO that throws is not an operation_state",
40+
// "[concepts][operation_state]") {
41+
// REQUIRE(!ex::operation_state<op_except>);
42+
//}
4343

4444
TEST_CASE("type with start CPO noexcept is an operation_state","[concepts][operation_state]") {
4545
REQUIRE(ex::operation_state<op_noexcept>);

‎test/stdexec/cpos/test_cpo_start.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,39 @@ namespace ex = stdexec;
2323
structmy_oper : immovable {
2424
bool started_{false};
2525

26-
friendvoidtag_invoke(ex::start_t, my_oper& self) {
26+
friendvoidtag_invoke(ex::start_t, my_oper& self)noexcept{
2727
self.started_ =true;
2828
}
2929
};
3030

3131
structop_value/*: immovable*/ {// Intentionally movable!
3232
bool* started_;
3333

34-
friendvoidtag_invoke(ex::start_t, op_value self) {
34+
friendvoidtag_invoke(ex::start_t, op_value self)noexcept{
3535
*self.started_ =true;
3636
}
3737
};
3838

3939
structop_rvalref : immovable {
4040
bool* started_;
4141

42-
friendvoidtag_invoke(ex::start_t, op_rvalref&& self) {
42+
friendvoidtag_invoke(ex::start_t, op_rvalref&& self)noexcept{
4343
*self.started_ =true;
4444
}
4545
};
4646

4747
structop_ref : immovable {
4848
bool* started_;
4949

50-
friendvoidtag_invoke(ex::start_t, op_ref& self) {
50+
friendvoidtag_invoke(ex::start_t, op_ref& self)noexcept{
5151
*self.started_ =true;
5252
}
5353
};
5454

5555
structop_cref : immovable {
5656
bool* started_;
5757

58-
friendvoidtag_invoke(ex::start_t,const op_cref& self) {
58+
friendvoidtag_invoke(ex::start_t,const op_cref& self)noexcept{
5959
*self.started_ =true;
6060
}
6161
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp