funkwerk/accessors

enum template as template parameter

Opened this issue · 0 comments

The following code fails with

Error: template stuff.TestEnum(string name) is used as a type

template TestEnum(string name)
{
    enum TestEnum : bool
    {
        yes = true
    }
}

struct TestStruct(TestEnum!"str" str)
{
}

class TestClass
{
    @Read
    TestStruct!(TestEnum!"str".yes) flags1_;

    mixin(GenerateFieldAccessors);
}

It happens because neither .stringof nor std.traits.fullyQualifiedName retrive the exact type. So

typeof(__traits(getMember, typeof(this), "flags1_")).stringof

is translated into TestStruct!cast(TestEnum)true, but the right type representation should be:
TestStruct!(cast(TestEnum!"str")true)