www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: Marco.Leise gmx.de



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: -------
Feb 21 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com




 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]
It's not about the surrounding code, but rather, whether or not you use the .init property. Reduced test case: //---- struct ExpandData { ubyte[4096] window = 0; } void main() { ExpandData a; auto b = ExpandData.init; //Comment me. } //---- Works in 2.061, so is a regression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566





 It's not about the surrounding code, but rather, whether or not you use the
 .init property.
Right, came from the message boards, where you said "I didn't imagine it would depend on any surrounding code", and didn't notice you had already pinned it in the title. Please ignore that sentence then. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/1688

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ac3de50bcff047b86ff8fe8778f00e8f4845315c
fix Issue 9566 - Cannot use struct .init when it contains static array
initialized from a single element.

https://github.com/D-Programming-Language/dmd/commit/f5eb6d5f9684ff6276cdbc52919b5b877d36d72d


[REG 2.062] Issue 9566 - Cannot use struct .init when it contains static array
initialized from a single element.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566




Commit pushed to 2.062 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e8521cb9e23119a50a6d97af0f5d9e6e5e16f8bf


[REG 2.062] Issue 9566 - Cannot use struct .init when it contains static array
initialized from a single element.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9566


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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