www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4213] New: Strange behaviour with static void[] arrays

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4213

           Summary: Strange behaviour with static void[] arrays
           Product: D
           Version: 1.057
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: nfxjfg gmail.com



This code always worked:

struct X {
 union {
   void[] a;
   void[9] b;
 }
}

However, if you remove the union (so that a, b are direct struct members), it
stops working and outputs "Error: integral constant must be scalar type, not
void" (without line number information!). It also stops compiling if you remove
the "a" member.

It also generates a wrong .sizeof for the struct (12 instead of 9*4). Not sure
what exactly is going on.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4213




Never mind that bit about the struct's size, b is 9 bytes, aligned on 4 = 12
bytes. Correct.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4213


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



Note that this compiles on v2.046, but it stops compiling if you remove the
=void, so that problem can be by design:


void main() {
    void[1] a = void;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 20 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4213


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



22:19:19 PDT ---
improved error message with changeset 496

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