D2.008 const test doesn't work

Janice Caron caron800 at googlemail.com
Thu Nov 29 02:45:19 PST 2007


Extra diagnosis. The following program:

    import std.stdio;

    template constType(T)
    {
        pragma(msg,T.stringof);

        static const string constType = T.stringof;
    }

    void main()
    {
        writefln(constType!(int));
        writefln(constType!(const(int)));
        writefln(constType!(invariant(int)));
    }

Prints "int" (only) at compile time, and three "int"s at runtime.

It seems the constness of the template parameter is not being passed
into the template.


More information about the Digitalmars-d-bugs mailing list