D-Programming-Language/dmd — pull request #894 by donc (2012-04-20 11:42:36+00:00)
Title: CTFE refactoring -- move ALL interpreting into CTFE

This fixes a structural problem. Up to now, CTFE was initiated with a call to
optimize(WANTvalue | WANTinterpret). The CTFE engine only starts when there is a function call.
There are lots of (buggy!) special cases in optimize.c for the case where WANTinterpret is set outside of a function call. This duplicates code from interpret.c. This commit removes the distinction between the interpreter and CTFE.

It incidentally fixes a few bugs, such as:

7640 CTFE: Confusing error message when looking up missing hash key

and it allows code like this to work

class X { int y; this() { y = 2; }}
static assert( (new X).y == 2);

since the class never actually leaves the interpreter.