[Issue 6705] New: Bad codegen when passing fields as template alias params

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 21 02:23:22 PDT 2011


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

           Summary: Bad codegen when passing fields as template alias
                    params
           Product: D
           Version: D2
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: thecybershadow at gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow at gmail.com> 2011-09-21 02:22:48 PDT ---
I'm not sure if this is valid code, so it's either accepts-invalid or
wrong-code.
I was trying to implement member field pointers, when I ran into this:

int func(alias F)(int i)
{
    return i;
}

class C
{
    int a;
}

void main()
{
    auto a = &func!(C.a);
    assert(a(5) == 5);
    //auto i = func!(C.a)(5); // uncomment for a weird compiler error
}

-- 
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