Hi,

following coding is throwing compiler error:
  need this for name of type string

The error disappears if I delete method0.
My gut feeling is, this is a compiler bug?

---
class C
{
    static this()
    {
        getT!(typeof(this))();
    }

    @Foo void method0(){}

    @Foo("abc") void method1(){}
}

struct Foo
{
    string name;
}

void getT(T)()
{
    import std.traits: hasUDA, getUDAs;

    static foreach(fieldName; __traits(allMembers, T))
    {
static if (hasUDA!(__traits(getMember, T, fieldName), Foo))
        {
pragma(msg, getUDAs!(__traits(getMember, T, fieldName), Foo)[0].name);
        }
    }
}

void main(){}
---

Kind regards
André

Reply via email to