www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14154] New: [e2ir] Error in e2ir at casting to struct

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

          Issue ID: 14154
           Summary: [e2ir] Error in e2ir at casting to struct
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: ketmar ketmar.no-ip.org

mixin template XTypedef (T, string name, T init=T.init) {
  mixin(`static struct `~name~q{{
    public alias k_8_i_m_p_l this;
    private T k_8_i_m_p_l=init;
  }});
}


void test () {
  mixin XTypedef!(ubyte, `uint8`);
  mixin XTypedef!(int, `MyInt`);
  MyInt mi;
  ubyte t = cast(uint8)mi;
}


zzbug.d(13): Error: e2ir: cannot cast mi.k_8_i_m_p_l of type int to type uint8

--
Feb 09 2015