www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22369] New: Unreachable statements in std.concurrency with

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 puremagic.com
          Reporter: moonlightsentinel 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

--
Oct 08 2021