[Issue 2379] CTFE fails unless it is very straightforward

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 30 05:56:31 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2379





------- Comment #2 from snake.scaly at gmail.com  2008-09-30 07:56 -------
Everything works as expected.

template Test0(invariant(char)[] text)
{
    auto Test0 = text;
}

effectively declares

invariant(char)[] Test0 = "hello";

which is a variable initialized at runtime. The correct way
to write this template is

template Test0(invariant(char)[] text)
{
    enum Test0 = text;
}

which declares a manifest constant.


-- 



More information about the Digitalmars-d-bugs mailing list