Hi,

It's been a while since I've used CTFE, and I was wondering if it has become possible to do something like this:


void ctfeFunc(string arg)
{
        pragma(msg, "arg is "~arg);
}

void main()
{
        ctfeFunc("foo");
}

That specific attempt gives me an error:
test.d(3): Error: variable arg cannot be read at compile time
"arg is " ~ arg

I'm using a git version of dmd that reads as v2.057. I don't feel like upgrading thanks to bug 5278:
http://d.puremagic.com/issues/show_bug.cgi?id=5278
and the github situation where dmd, druntime, and phobos (and the docs?) all live in different github projects that aren't tracked collectively anywhere (last time I messed with it), thus making it sometimes frustrating to find buildable commits that will work with each other.

I want some way to print out the state of variables in a function being executed at compile time. Can it be done?

Reply via email to