[Issue 11946] "need 'this' to access member" when passing field to template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 18 23:45:51 PST 2014


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2014-01-18 23:45:48 PST ---
It's intended behavior introduced by issue 11533. Now, alias parameter is
preferred than 'static' attribute _on template_.

If you really need the syntax f!x(), you should define function template 'f'
like follows:

template f(alias X)
{
    static string f()
    {
        //int x = X;
        return X.stringof; // OK
    }
}
struct S
{
    int i;
    enum y = f!i();
    pragma(msg, y);
}

-- 
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