Bug 23927 – Missing unreachable warning after call to a noreturn function as if-condition

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-05-18T22:03:00Z
Last change time
2023-05-20T00:40:29Z
Keywords
accepts-invalid, diagnostic
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2023-05-18T22:03:00Z
The following code compiles without warning ``` alias NR = typeof(assert(0)); NR test(){assert(0);} void main() { if (test()) { } return; } ``` but there should be one on the ReturnStatement located in `main` because it is not reachable. The same problem can be observed if the IfStatement is replaced with a WhileStatement.
Comment #1 by b2.temp — 2023-05-20T00:40:29Z
"noreturn is the bottom type which can implicitly convert to any type" bool in that case