Comment #0 by bruno.do.medeiros+deebugz — 2006-08-02T17:19:55Z
Undefined identifier in instances of templates with forward mixins. The following fails to compile:
----
template TplWithMixin() {
mixin Mnum!();
}
//Error: undefined identifier TplWithMixin!().cnum :
auto a = TplWithMixin!().cnum;
template Mnum() {
const int cnum = 2;
}
----
If TplWithMixin!().cnum is accessed only inside a function, then no error occurs.
But if an instance of TplWithMixin is made outside a function, and before the mixin template, then the function instances will also fail when accessing members. This code exemplifies:
-----
template TplWithMixin() {
mixin Mnum!();
}
void test() {
//Error: undefined identifier TplWithMixin!().cnum :
auto a = TplWithMixin!().cnum;
}
// Compiles ok if this line is removed or placed after Mnum :
alias TplWithMixin!() xxx;
template Mnum() {
const int cnum = 2;
}
----