[Issue 11079] New: Attributes for template functions should be visible when used with traits

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 20 14:36:58 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11079

           Summary: Attributes for template functions should be visible
                    when used with traits
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-09-20 14:36:56 PDT ---
-----
interface A
{
    static void foo(B obj)
    {
        // ok
        static assert(__traits(isStaticFunction,
            __traits(getMember, obj, "foo")));
    }

    static void bar(T)(T obj)
    {
        // fails
        static assert(__traits(isStaticFunction,
            __traits(getMember, obj, "bar")));
    }
}

class B : A
{
}

void main()
{
    B b = new B;
    b.foo(b);
    b.bar(b);
}

-----

I think this is the same symptom as in
http://d.puremagic.com/issues/show_bug.cgi?id=194, and particularly Walter's
comment http://d.puremagic.com/issues/show_bug.cgi?id=194#c1.

However, the templated function 'bar' is static regardless of what it's
instantiated with, so the traits should likely be able to work with it.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list