On Mon, 01 Oct 2012 01:40:37 -0400, Tommi <tommitiss...@hotmail.com> wrote:
import std.stdio; int pow2(int val) pure { if (__ctfe) return 6; else return val * val; } void main() { assert(pow2(3) == 9); static assert(pow2(3) == 6); writeln("9 = 6 ... I knew it! '6' was faking it all along"); readln(); }
You have a bug in your code, here let me fix that for you:
int pow2(int val) pure { return val * val; }
OK, on to the next thread... -Steve