Comment #0 by dlang-bugzilla — 2014-03-02T07:02:53Z
///////// 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).
Comment #1 by dlang-bugzilla — 2014-03-02T12:31:10Z