www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15707] New: Extend aggregate TypeInfo with information about


          Issue ID: 15707
           Summary: Extend aggregate TypeInfo with information about
                    `alias this`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: public dicebot.lv


enhance TypeInfo so that for a struct like this:

struct S
    byte[8] x;
    int y;
    alias y this;

.. the following code will be valid:

auto ti = typeid(S.init);
assert (ti.aliasthis.offset == 8);
assert (ti.aliasthis.next == typeid(int.init));

Use case:

RTTI based formatting/logging, most importantly in cases where `alias this`
struct is used as a replacement for typedef.

Feb 20 2016