[Issue 6098] Static array corruption of data

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 3 06:30:15 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6098


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos
            Summary|CTFE static array           |Static array corruption of
                   |corruption of data          |data


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-06-03 06:25:49 PDT ---
Actually this has nothing to do with CTFE:

import std.math;
import std.stdio;
import std.range;

auto makeSine()
{
    double[10] result;
    //~ double[] result = new double[](TableSize);  // this fixes the issue

    foreach (index, ref sample; result)
    {
        sample = cast(double)sin((cast(double)index / cast(double)10) * PI *
2.);
    }
    writeln(result);
    return cycle(result);
}

void main()
{    
    auto sineTable = makeSine();
    writeln(take(sineTable, 10));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list