xxxxxxxxxx
--- foo.d
struct S
{
private int* p;
this(int x, int y) { p = &[x, y][0]; }
int get2nd() { return p is null ? 0 : p[1]; }
/* Assuming that p is only ever set by the constructor.
So it's either null or there must be two elements. */
}
--- bar.d
import foo;
import std.stdio;
void main()
{
auto s = S(1, 2);
s.tupleof[0] = &[10][0]; /* Should not be allowed. */
writeln(s.get2nd()); /* garbage */
}