www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21016] New: `Type.Field.init` is `typeof(Type.Field).init`,


          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 puremagic.com
          Reporter: pro.mathias.lang 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));

Jul 05 2020