__ctfe

Daniel Murphy yebblies at nospamgmail.com
Tue Oct 2 01:42:51 PDT 2012


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.477.1349164468.5162.digitalmars-d at puremagic.com...
>
> By the way, why is it not used in static if? That's what most of us would 
> have
> expected (and it frequently seems to trip people up). I assume that it's 
> due
> to some implementation detail of CTFE (like it doesn't really compile any
> functions differently for CTFE)?
>
> - Jonathan M Davis

Code inside static if blocks does not have to be semantically valid if it is 
not selected, and is discarded well before the interpreter could be invoked 
on it.  It could be done using static if or version, but that would require 
duplicating the function and re-running semantic, which is less elegant and 
not really what you want.
There is a little bit of explanation in the original bug report: 
http://d.puremagic.com/issues/show_bug.cgi?id=3556 




More information about the Digitalmars-d mailing list