https://d.puremagic.com/issues/show_bug.cgi?id=12285

           Summary: Allow local symbols in alias parameter to non-static
                    templates when both have same scope
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]
            Blocks: 12230


--- Comment #0 from Vladimir Panteleev <[email protected]> 2014-03-02 
17:02:53 EET ---
///////// test.d ////////
struct S
{
    int a, c;

    template toA(alias s)
    {
        void copy()
        {
            a = s;
        }
    }

    alias cToA = toA!c;
}

unittest
{
    S s;
    s.c = 42;
    s.cToA.copy();
    assert(s.a == 42);
}
/////////////////////////

Currently, this produces:

test.d(13): Error: template instance toA!(c) cannot use local 'c' as parameter
to non-global template toA(alias s)

Note that this restriction only applies to variables, but not methods, because
of issue 12230. Fixing 12230 without merging this would surely break code (e.g.
is std.regex, see set!setInvMask).

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

Reply via email to