Adam S:
Most template member funs seems to work fine. The issue only
seems to appear when the member function is overloaded. For
example
class Foo {
auto test(alias val)() if (is(typeof(val) == int)){}
//auto test(alias val)() if (!is(typeof(val) == int)){}
}
void main() {
auto bar = new Foo;
with (bar) {
test!2(); //works
}
}
works fine until the overload of test is uncommented. Then the
same error occurs.
with() was designed and created to access fields of structs in a
simpler way. In D also enum and class members are usable with
with(). Your use case seems a corner case of a usage pattern that
was not included. So perhaps you have to write an enhancement
request.
Bye,
bearophile