November 03, 2023
https://issues.dlang.org/show_bug.cgi?id=24223

          Issue ID: 24223
           Summary: __traits(initSymbol) should work for enum types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: snarwin+bugzilla@gmail.com

An enum type can have its own default initializer, independent of its base type:

---
enum E : int { a = 123 }
static assert(E.init != int.init);
---

This initializer is currently made available through TypeInfo.initializer:

---
enum E : int { a = 123 }

void main()
{
    E e;
    const(void)[] initializer = typeid(E).initializer;
    assert(cast(const(void)[]) (&e)[0 .. 1] == initializer);
}
---

However, it is not available through __traits(initSymbol), which makes it
difficult to access without depending on druntime (e.g., in BetterC code).

--