When I try compile code like this:
module main;
class A(T) {
static string g(string v) { return "a" ~ v; }
immutable b = immutable C!(T)("u");
}
class B : A!(B) {}
immutable struct C(T) {
string a;
alias a this;
this(string a) {
this.a = T.g(a); // but with this.a = a it is ok;
}
}
void main(string[] args) {}
I get Exit code 139
Comment #1 by yebblies — 2013-11-20T22:28:55Z
Now gives
testx.d(13): Error: no property 'g' for type 'testx.B'
testx.d(6): Error: template instance testx.A!(B) error instantiating
Comment #2 by kozzi11 — 2013-11-21T02:45:29Z
(In reply to comment #1)
> Now gives
>
> testx.d(13): Error: no property 'g' for type 'testx.B'
> testx.d(6): Error: template instance testx.A!(B) error instantiating
This is better than exit code 139. But is this desired behaviour?
When I rewrite:
immutable b = immutable C!(T)("u");
to:
immutable b = immutable C!(A!T)("u");
It works as I expected, but why I can not just write
T instead of A!T? Maybe some circular reference?