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

           Summary: CTFE array assignment for struct members fails
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: ice-on-valid-code, wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: lud...@informatik.uni-luebeck.de


--- Comment #0 from S´┐Żnke Ludwig <lud...@informatik.uni-luebeck.de> 2010-03-18 
23:44:20 PDT ---
In the following code snipped, for global variables or enums, this.s is not
correctly written in the constructor. The direct way to assign a value without
the 'dst' temporary does not work due to
http://d.puremagic.com/issues/show_bug.cgi?id=3801.

---
struct S {
    float[1] s;

    this(float x){
        float[] dst = this.s;
        dst[0] = x;
    }
}

S S_zero = S(0); // initialization fails
enum S S_zero2 = S(0); // initialization fails

void main()
{
    //enum S z = S(0); // ICE
    //static S z = S(0); // ICE
    //S z = S(0); // works, initialized with 0
    //S z = S_zero; // contains NaN
    S z = S_zero2; // contains NaN

    assert(z.s[0] == 0);
}
---

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

Reply via email to