Battle-plan for CTFE

Johannes Pfau via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 30 03:42:35 PDT 2016


Am Tue, 30 Aug 2016 08:35:20 +0000
schrieb Stefan Koch <uplink.coder at googlemail.com>:

> I do not see how this could affect @nogc.

@nogc is only meaningful at runtime. So this could work:

module foo;
@nogc:
[...]

string ctfeOnly(string name)
{
    static assert(!__ctfe);
    // error: cannot use operator ~ in @nogc function
    return "int " ~ name ~ ";";
}
mixin(ctfeOnly("foo"));


More information about the Digitalmars-d-announce mailing list