June 02, 2010
dmd commit, revision 517


user: walter

msg:
Don Clugston wrote:

This is a fix for the bug which is #6 on my list. CTFE has not been
checking for usage of local variables, and this creates a host of
problems.
Several forms of ICE and wrong-code are fixed by this patch.

Another drop-in replacement for interpret.c on both D1 and D2. But you
also need to modify
declaration.c, line 1554. Remove the check for !isDataSeg(), it's wrong.
Also need the != 0, because it returns an int, not a bool.
Function becomes:

int VarDeclaration::isCTFE()
{
    return (storage_class & STCctfe) != 0;
}

This is the underlying bug -- a local variable in a function isn't CTFEable just because it's not a static; the function it's in must have have been CTFEd. This necessitates many small changes in interpret.c.

Fixes
4257 ICE(interpret.c): passing parameter into CTFE as ref parameter

Bug 3809 is the only open wrong-code regression, this patch also turns
it into rejects-valid:
3809 Struct initializers apparently always CTFE'd, and incorrectly

http://www.dsource.org/projects/dmd/changeset/517