[Issue 9566] New: Cannot use struct .init when it contains a static array initialized from a single element.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 21 21:26:12 PST 2013


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

           Summary: Cannot use struct .init when it contains a static
                    array initialized from a single element.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: Marco.Leise at gmx.de


--- Comment #0 from Marco Leise <Marco.Leise at gmx.de> 2013-02-21 21:26:11 PST ---
Seeing is believing. Reduced test case:
____________________

import core.stdc.stdlib;

struct SZDDFile
{
    ExpandData* pExpandData = null;

    struct ExpandData
    {
        ubyte[4096] window = 0;
    }

    void open()
    {
        pExpandData = cast(ExpandData*) malloc (ExpandData.sizeof);
        *pExpandData = ExpandData.init;
    }
}
____________________

Error: cannot implicitly convert expression (cast(ubyte)0u) of type ubyte to
ubyte[4096LU]

-- 
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