[Issue 6681] bogus duplicate union initialization or overlapping initialization errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 24 20:58:36 PDT 2011


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> 2011-10-24 20:57:25 PDT ---
There have been several patches to 'fix' struct/union initialization.
Evidently, we need to step back a bit and rethink/reengineer it. Something
along the lines of:

1. Create a list of all the fields, in lexical order. Each field will have a
beginning offset and an ending offset. One field 'overlaps' another if its
offset range overlaps the other.

2. Examine list of initializers. Unnamed initializers will be associated with a
field as follows:
    1. if it's the first initializer, it's the first field. Done.
    2. start with the previous field that was initialized. Move forward through
    the field list and pick the first field that does not overlap with that
    previous field. That will be the field associated with that initializer.

3. If any initialized field overlaps with any other initialized field, error.

4. Go back through the field list again, in order. If a field does not have an
initializer, and does not overlap with any other initialized field, assign it
the default initializer.

At this point, I wish to defer this to the next update.

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