www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24112] New: binary expressions with noreturn vars produce

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 puremagic.com
          Reporter: elpenguino+D 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.

--
Aug 26 2023