www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12285] New: Allow local symbols in alias parameter to non-static templates when both have same scope

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com
            Blocks: 12230


--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 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: -------
Mar 02 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12285


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Vladimir Panteleev <thecybershadow gmail.com> 2014-03-02
22:31:10 EET ---
https://github.com/D-Programming-Language/dmd/pull/3345

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