Bug 22369 – Unreachable statements in std.concurrency with noreturn values / callbacks

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-08T18:56:27Z
Last change time
2021-10-13T18:18:39Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel

Comments

Comment #0 by moonlightsentinel — 2021-10-08T18:56:27Z
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
Comment #1 by dlang-bot — 2021-10-08T19:01:20Z
@MoonlightSentinel created dlang/phobos pull request #8266 "Fix 22369 - Omit unreachable statements in std.concurrency" fixing this issue: - Fix 22369 - Omit unreachable statements in std.concurrency Instantiating these templates with noreturn values / callbacks causes the versioned statements to become unreachable. https://github.com/dlang/phobos/pull/8266
Comment #2 by dlang-bot — 2021-10-13T18:18:39Z
dlang/phobos pull request #8266 "Fix 22369 - Omit unreachable statements in std.concurrency" was merged into master: - 4cf70e6c431660461a0a705abf57ee329012f675 by MoonlightSentinel: Fix 22369 - Omit unreachable statements in std.concurrency Instantiating these templates with noreturn values / callbacks causes the versioned statements to become unreachable. https://github.com/dlang/phobos/pull/8266