specializing template with string variable in CTFE

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 26 12:32:17 PDT 2014


On Sun, 26 Oct 2014 12:46:06 +0000
via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> The second possibility doesn't exist right now. The core problem 
> is that the compiler needs to be able to generate runtime code 
> for `buildWriter()`, because it's just a function after all.
but it's templated function, and it's never called in runtime, so
compiler never needs to generate code for it. seems that semantic
analysis prohibits such code before CTFE, and semantic analyser is
completely wrong here, 'case `fmt` *can* be read in compile-time.

actually, semantic analiser is wrong for any CTFE-able function in this
case, and it emits completely wrong error message (compile time
variable can't be read in compile time? how this can be true?).

i understand that it can be hard to fix semantic analyser though. ah,
but this limitation is so... limiting!

not sure if it worth the ER though. people seems to not write alot of
complex CTFE code anyway.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141026/81e3f092/attachment.sig>


More information about the Digitalmars-d-learn mailing list