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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|{ } struct literals not     |member default initializers
                   |documented, and not working |not working in static
                   |                            |struct initializers


--- Comment #4 from Don <clugd...@yahoo.com.au> 2012-05-29 00:56:54 PDT ---
They are documented in struct.html, "Static Initialization of Structs"

The bug is that default initializers are ignored for members which aren't in
the struct static initializer. When this bug was originally filed, they got
garbage.
Now they use the default initializer for the type, but they should use the
member initializer, if one is present.

Barely tested patch, in init.c (350), StructInitializer::toExpression():

            if (!(*elements)[i])
               // Default initialize
+                if (vd->init)
+                    (*elements)[i] = vd->init->toExpression();
+                else                
                    (*elements)[i] = vd->type->defaultInit();

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

Reply via email to