[Issue 24112] New: binary expressions with noreturn vars produce inconsistent results
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 26 20:20:01 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24112
Issue ID: 24112
Summary: binary expressions with noreturn vars produce
inconsistent results
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid, wrong-code
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: elpenguino+D at gmail.com
```
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.
--
More information about the Digitalmars-d-bugs
mailing list