[Issue 19846] New: Identity function causes code returning byte[0] to not be executed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 5 18:28:07 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19846

          Issue ID: 19846
           Summary: Identity function causes code returning byte[0] to not
                    be executed
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andy.pj.hanson at gmail.com

```
import core.stdc.stdio : printf;

alias Void = byte[0];
static immutable byte[0] VOID = [];

Void print() {
        printf("This should print");
        return VOID;
}

Void identity(Void value) {
        return value;
}

void main() {
        identity(print());
}
```

Running this program should print "This should print", but instead nothing
happens.
The program works if `identity(print())` is replaced with just `print()`.

--


More information about the Digitalmars-d-bugs mailing list