D-Programming-Language/dmd — pull request #2140 by donc (2013-06-06 08:13:58+00:00)
Title: 10280 CTFE: Circular variable initializers should be detected properly

Use the existing 'inuse' mechanism to detect cycles.

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

This is part of my project to unify optimize(WANTinterpret) and CTFE. The existing CTFE behaviour (detect circular definitions only by stack overflow) doesn't work for const folding, since there are no function calls involved. And this method gives much better error messages.