[Issue 15707] New: Extend aggregate TypeInfo with information about `alias this`

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Feb 20 04:59:52 PST 2016


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

          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 at puremagic.com
          Reporter: public at dicebot.lv

Proposal:

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.

--


More information about the Digitalmars-d-bugs mailing list