The following code will cause an access violation error. T delegate() lazier(T)(lazy T arg){ bool once = true; T value; return { if(once){ once = false; value = arg; } return value; }; } void main(){ auto l = lazier(rand()); writeln(l()); // Access violation }
This failed in 2.012, but was fixed by 2.020.