www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4321] New: Passing local parameter to non-global template fails.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4321

           Summary: Passing local parameter to non-global template fails.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: yanikibo gmail.com
        Depends on: 3052



PDT ---
class C
{
    void f(int i)()
    {
    }

    void g()
    {
        foreach (i; Range!(1,10))
            f!(i)();
    }
}


Error: template instance cannot use local 'i' as parameter to non-global
template f(uint i)

I think it should work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 15 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4321


ibrahim YANIKLAR <yanikibo gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com



PST ---
The code below works:

class C
{
    void f(int i)()
    {
    }

    void g()
    {
        foreach (i; Range!(1,10))
            h!(i)(this);
    }
}

void h(int i)(C c)
{
    c.f!(i)();
}

Probably that is only a compiler limitation and can be fixed (or removed)
without much effort.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 27 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4321


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mrmocool gmx.de
         Resolution|                            |WORKSFORME



Works now.

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