This issue left me with a permanent avoidance of ref foreach after encountering it the first day I used D.

On 20/01/2012 10:25 PM, Andrej Mitrovic wrote:
One of the first bugs I've filed (now 1.5+ years old):

void main()
{
     float[] arr = [1.0, 2.5, 4.0];
     foreach (ref double elem; arr) {
         elem /= 2;
     }
     writeln(arr);  // still [1, 2.5, 4]
}

Issue 4510

Reply via email to