Bug 22386 – Unreachable warning for assertThrown with noreturn value
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-14T10:19:56Z
Last change time
2021-10-14T15:41:03Z
Keywords
pull
Assigned to
No Owner
Creator
moonlightsentinel
Comments
Comment #0 by moonlightsentinel — 2021-10-14T10:19:56Z
Passing a noreturn value to assertThrown triggers an unreachable statement warning, e.g.
noreturn throwEx() { throw new Exception(""); }
assertThrown(throwEx());
std/exception.d(297): Warning: statement is not reachable
Comment #1 by dlang-bot — 2021-10-14T10:22:19Z
@MoonlightSentinel created dlang/phobos pull request #8273 "Fix 22386 - Omit unreachable throw in assertThrown with noreturn value" fixing this issue:
- Fix 22386 - Omit unreachable throw in assertThrown with noreturn value
The lazy value will throw or never return at all and hence never
reach the additional throw statement.
https://github.com/dlang/phobos/pull/8273
Comment #2 by dlang-bot — 2021-10-14T15:41:03Z
dlang/phobos pull request #8273 "Fix 22386 - Omit unreachable throw in assertThrown with noreturn value" was merged into master:
- f08814120b1a26f0bb0b3a799c01bbbbcbda1cf5 by MoonlightSentinel:
Fix 22386 - Omit unreachable throw in assertThrown with noreturn value
The lazy value will throw or never return at all and hence never
reach the additional throw statement.
https://github.com/dlang/phobos/pull/8273