Template alias parameter: error: need 'this' for ...

Matej Nanut matejnanut at gmail.com
Fri Aug 23 14:28:46 PDT 2013


Hello!

I've run into this issue that I don't understand, maybe someone 
can enlighten me. :)

This code:
---
struct Thing
{
     int i;
}

void main()
{
     t!(Thing.i)();
}

void t(alias a)()
{
     return;
}
---

fails to compile with: ‘Error: need 'this' for 't' of type 'pure 
nothrow @safe void()'’.

If I declare ‘t’ as static, it works (and does what I want it to 
do).


More information about the Digitalmars-d-learn mailing list