Steven Schveighoffer wrote: > The only thing I could get to work is this: > > > struct S > { > int x; > } > > inout(int *) getSX(inout S* s) { return &s.x;} > > void main() > { > S s; > const(S)* sp = &s; > int *x = getSX(&s); > //int *y = getSX(sp); // uncomment this line for an error > const(int) *y = getSX(sp); > } > > If you uncomment the designated line, the error reads: > > testinout.d(13): Error: cannot implicitly convert expression (getSX(sp)) > of type const(int*) to int* > > which looks good.
The error looks misleading to me. The error is with the input argument to the function, not the return type.