Somehow this code works for me:

```D
auto error (int status, string description){
    struct Error {
        int status;
        string description;
    }
    Error err = {
        status,
        description
    };
    return err.serializeToJson;
}
```

which is supposed to be the same as

```D
struct Error {
    int status;
    string description;
}
auto error (int status, string description){
    Error err = {
        status,
        description
    };
    return err.serializeToJson;
}
```

If I'm reading this right, in the former, the struct is created when the function is called in run-time, and the type is then inferred after that? I don't really understand the behavior behind this.

Reply via email to