bug in pragma?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Jul 4 16:06:18 PDT 2013
On Friday, July 05, 2013 00:48:49 JS wrote:
> This is simply wrong. If s could not be used at compile time then
> the mixin could not be used at compile time... yet it can be and
> is being used and works fine when the pragma is removed... and
> one can even pragma the template name after the function and it
> will work.
You're misunderstanding the difference between CTFE and stuff that has to be
known at compile time. A function called with CTFE must be callable like any
other function at runtime. There's nothing special about it. It can be called
at compile time, but there can't be anything about its implementation which
requires it to be called at compile time. The only reason that the function is
even being called at compile time is because it's being used to initialize an
enum.
Contrast this with the value of an enum, which _must_ be known at compile
time.
- Jonathan m Davis
More information about the Digitalmars-d
mailing list