xxxxxxxxxx
import core.stdc.stdio;
__gshared int gi = 0;
struct A; struct B;
struct Node {
this();
nothrow:
int i;
this(int i) {
this.i = i;
}
this(ref Node o) {
gi++;
i = o.i;
}
ref auto getList() return scope {
if( i ) return NodeList(null); // remove this line will fix this error
A* a;
B* b;
auto list = NodeList(a, b);
return list;
}
}
struct NodeList {
nothrow: this(); this(this);
this(A* a, B* b) { }
this(A* a) { }
ref auto one() return {
return node(1) ;
}
private ref auto node(int i) return {
return Node(i);
}
}
extern(C) void main() nothrow {
NodeList list = NodeList(null);
auto one = list.one;
printf("gi=%d\n", gi);
}