On Saturday, 5 December 2015 at 20:44:40 UTC, Andrei Alexandrescu wrote:
Working on the big-oh thing I noticed that for an overloaded function, __traits(getAttributes, ...) applied to overloaded functions only fetches attributes for the first syntactically present overload. Bug or feature?

Did you use it in a loop with __traits(getOverloads) too?

Borrowing from the doc example:


import std.stdio;

class D
{
    this() { }
    ~this() { }
    @("test") void foo() { }
    @(12) int foo(int) { return 2; }
}

void main()
{
    D d = new D();

    foreach (t; __traits(getOverloads, D, "foo")) {
        // the getAttributes here inside the getOverloads
        // loop will cause it to get specific
        writeln(__traits(getAttributes, t));
        writeln(typeid(typeof(t)));
    }
}

Reply via email to