```
noreturn foo;
int a = foo / 1;
int b = foo + 1;
int c = foo - 1;
int d = foo * 1;
int e = foo % 1;
int f = foo ^^ 1;
int g = foo & 1;
int h = foo | 1;
int i = foo ^ 1;
int j = foo << 1;
int k = foo >> 1;
int l = foo >>> 1;
```
As of DMD 2.105.0, none of these statements produce the expected runtime errors. noreturn vars appear to be treated as integers with the value 0, except in the last three statements, which result in a compile error instead.
Comment #1 by dlang-bot — 2023-08-30T15:16:04Z
@ntrel created dlang/dmd pull request #15564 "Fix Issue 24112 - binary expressions with noreturn vars produce incon…" fixing this issue:
- Fix Issue 24112 - binary expressions with noreturn vars produce inconsistent results
https://github.com/dlang/dmd/pull/15564
it's true that noreturn isn't an integral type, but it can implicitly convert to integral types. other instances of implicit conversion are allowed (structs with integer alias this, for example), so I think noreturn should be "allowed" as well, for consistency
Comment #4 by dlang-bot — 2023-09-07T10:56:50Z
dlang/dmd pull request #15564 "Fix Issue 24112 - binary expressions with noreturn vars produce incon…" was merged into master:
- c5f9ca5bd2952b8f0667ab94133477e83596cdb9 by Nick Treleaven:
Fix Issue 24112 - binary expressions with noreturn vars produce inconsistent results
https://github.com/dlang/dmd/pull/15564
dlang/dmd pull request #15584 "Revert "Fix Issue 24112 - binary expressions with noreturn vars produ…" was merged into master:
- a90c6d25063b2f5a4e17c165acc63a2800ac68ac by Basile Burg:
Revert "Fix Issue 24112 - binary expressions with noreturn vars produce inconsistent results (#15564)"
This reverts commit 1a9a19f8b384a4c9f6d27dcd04f83bf8dd1546cf.
This breaks the test suite (fail_compilation/noreturn_expr.d).
https://github.com/dlang/dmd/pull/15584
Comment #7 by robert.schadek — 2024-12-13T19:30:37Z