variable _param_0 cannot be read at compile time

Kagamin spam at here.lot
Thu Aug 9 13:42:03 UTC 2018


struct M {
         int i;
         S*[100] s;
}
struct S {
         M* mp;
         bool x;
}

S* add(A...)() {
         alias m = A[0];
         __gshared s = S(&m,A[1..$]);
         m.s[m.i++] = &s;
         return &s;
}

void main(){
         __gshared M m = M(0);
         __gshared S s = S(&m, false);
         m.s[m.i++] = &s;
         auto p = add!(m, true);
}


More information about the Digitalmars-d-learn mailing list