Skip to content

Commit

Permalink
Merge pull request #408 from vibe-d/issue319_profile_build
Browse files Browse the repository at this point in the history
Fix compile error for profile builds
  • Loading branch information
l-kramer authored Aug 2, 2024
2 parents cec1d29 dfa6bc1 commit b31822c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions source/vibe/internal/async.d
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 137,10 @@ void asyncAwaitAny(bool interruptible, Waitables...)(string func = __FUNCTION__)
~ "scope (exit) {\n"
~ " if (!fired["~i.stringof~"]) {\n"
~ " debug(VibeAsyncLog) logDebugV(\"Cancelling operation %%s\", "~i.stringof~");\n"
~ " static if (is(WR"~i.stringof~" == void)) Waitables["~i.stringof~"].cancel(() @trusted { return callback_"~i.stringof~"; } ());\n"
~ " else Waitables["~i.stringof~"].cancel(() @trusted { return callback_"~i.stringof~"; } (), wr"~i.stringof~");\n"
~ " any_fired = true;\n"
~ " fired["~i.stringof~"] = true;\n"
~ " static if (is(WR"~i.stringof~" == void)) Waitables["~i.stringof~"].cancel(() @trusted { return callback_"~i.stringof~"; } ());\n"
~ " else Waitables["~i.stringof~"].cancel(() @trusted { return callback_"~i.stringof~"; } (), wr"~i.stringof~");\n"
~ " }\n"
~ "}\n"
~ "if (any_fired) {\n"
Expand Down Expand Up @@ -257,3 257,13 @@ private template hasAnyScopeParameter(Callback) {
static if (SC.length == 0) enum hasAnyScopeParameter = false;
else enum hasAnyScopeParameter = any!(c => c & ParameterStorageClass.scope_)([SC]);
}

static if (is(noreturn)) // issue 299, requires newer host compilers
version (unittest) {
alias CB = noreturn delegate(int) @safe nothrow;
alias wait = delegate noreturn(_) => assert(0);
alias cancel = delegate noreturn(_, x) => assert(0);
alias done = delegate noreturn(_) => assert(0);
alias w = Waitable!(CB, wait, cancel, done);
static assert (__traits(compiles, { asyncAwaitAny!(false, w); }));
}

0 comments on commit b31822c

Please sign in to comment.