[Issue 21016] New: `Type.Field.init` is `typeof(Type.Field).init`, not the field initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 6 03:04:58 UTC 2020


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

          Issue ID: 21016
           Summary: `Type.Field.init` is `typeof(Type.Field).init`, not
                    the field initializer
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: pro.mathias.lang at gmail.com

```
struct Params
{
    uint value = 4242;
}

pragma(msg, Params.value.init);
```

This should print `4242`, not `0u`. It can be worked around by using
`Params.init.value` but that hoop shouldn't be necessary.

Likewise the following should work:
```
template Default (alias Field)
{
    enum Default = Field.init;
}
pragma(msg, Default!(Params.value));
```

--


More information about the Digitalmars-d-bugs mailing list