dmd 1.068 and 2.053 release
Don
nospam at nospam.com
Mon May 16 00:22:28 PDT 2011
Jonathan M Davis wrote:
> On 2011-05-15 03:50, Joel Christensen wrote:
>> Looks like enum's are tighter (eg. 'enum last = media[ $ - 1 ];' doesn't
>> work now). It was working in 52. I had heard it might be relaxed, not
>> tightened. I get the error, 'cannot be read at compile time'.
>>
>> Also immutable imstr = "test"; printf( toStringz( imstr ) ); wasn't
>> working at first, but works now for some reason.
>>
>> Good to have an update though.
>
> A lot of CTFE stuff was rewritten. What all of the implications of that are, I
> don't know, but according to Don (who did the rewrite), there are cases which
> compiled before but didn't generate correct code. I don't know if there were
> any cases which compiled which were supposed to be illegal.
There are VERY MANY cases which compiled before, which were supposed to
be illegal. The compiler used to accept a variable where it needed a
compile-time constant!
> Regardless,
> because there was a major rewrite for CTFE, the risk of CTFE bugs or
> behavioral changes is higher than is the case for most releases.
To clarify:
Two massive fixes were made, which are independent of each other:
(1) CONSTANT FOLDING: any case where a compile-time value is required
now MUST be a compile-time value. If a compile-time value is not
required, there is no attempt to interpret it. This fixed many
accepts-invalid bugs.
(2) CTFE: array literals no longer use copy-on-write (which gave totally
wrong semantics). This fixed many wrong-code bugs.
Fixing (2) also allowed a huge number of CTFE bugs to be fixed.
This particular example is a consequence of (1), and has nothing to do
with the CTFE changes.
More information about the Digitalmars-d-announce
mailing list