[Issue 11098] template instance x cannot use local y as parameter to non-global template z

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 12 07:03:31 PST 2013


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


Ralph Tandetzky <ralph.tandetzky2 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ralph.tandetzky2 at gmail.com


--- Comment #1 from Ralph Tandetzky <ralph.tandetzky2 at gmail.com> 2013-12-12 07:03:28 PST ---
I got the same problem with DMD64 D Compiler v2.063.2 on Linux Mint with the
following minimal code example:

struct S
{
    void f(alias F)()
    {
    }
}

void main()
{
    S.init.f!( x=>x ); // << error
}

I get the following error message:

test.d(10): Error: template instance f!(__lambda2) cannot use local
'__lambda2(__T1)(x)' as parameter to non-global template f(alias F)()

The UFCS form of f works though:

struct S
{
}

void f(alias F)( S )
{
}

void main()
{
    S.init.f!( x=>x ); // << works
}

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


More information about the Digitalmars-d-bugs mailing list