[Issue 22369] New: Unreachable statements in std.concurrency with noreturn values / callbacks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 8 18:56:27 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22369

          Issue ID: 22369
           Summary: Unreachable statements in std.concurrency with
                    noreturn values / callbacks
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: moonlightsentinel at disroot.org

Using std.concurrency with noreturn values, functions, delegates, ... causes
multiple "unreachable statement" warnings.

==========================================================================

import core.time : Duration;
import std.concurrency;

void main()
{
    static noreturn foo(int) { throw new Exception(""); }

    // Rejected due to a different issue
    // spawn(&foo, 1);
    // spawnLinked(&foo, 1);

    receive(&foo);
    receiveTimeout(Duration.init, &foo);

    receiveOnly!noreturn();
    send(Tid.init, noreturn.init);
    prioritySend(Tid.init, noreturn.init);
    yield(noreturn.init);

    __gshared noreturn n;
    initOnce!n(noreturn.init);
}


==========================================================================
std\concurrency.d(2158): Warning: statement is not reachable
std\concurrency.d(2748): Warning: statement is not reachable

--


More information about the Digitalmars-d-bugs mailing list