[Issue 10995] CTFE failures for structs with void initialized members

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 13 00:55:40 PDT 2013


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


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #4 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-09-13 00:55:37 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > This is not a regression. The change in behaviour is an accepts-invalid bug
> > that was fixed. In both cases, an uninitialized variable is indeed being read.
> 
> I somehow expected that answer, but I'm not sure I entirely agree.
> 
> Marking a field to void means the compiler is allowed to optimize out giving
> the field a deterministic value on initializing the field, for run-time
> performance reasons. But that don't mean it's not actually initialized. I think
> that for CTFE, it should *just work*

Marking a field of aggregate to void does different thing comparing to void
initialization of variable - it makes dmd to blit memory with zeroes regardless
of type (for many types default value is zero, but for some types - likes
doubles and chars dmd still produces zeroes). I think CTFE should follow
runtime in this regard, so in your example value of 'a' should be zero.

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