Mr. Pib wrote:

string Q(alias T, alias D)()
{
        pragma(msg, T);
        pragma(msg, D);
        enum x = T~" = "~D~";";
        pragma(msg, x);
}


mixin(Q!(`x`, 100)());

outputs, at compile time,

x
100
x = d;

there is no lowercase d. I did initially define Q as

string Q(alias T, D)(D d)

and one might think it is remnants left over from I cleaned the project so it shouldn't be happening. Seems like a bug.

(I realized that I'd probably only ever pass compile time values)

Of course, using D.stringof gives the value.

The problem is the case of D.

nope. the problem is the *value* of D. `char(100)` == 'd'.

        string s = "<"~100~">";

yes, this works. weither this bug or not is questionable, but this is how D works regerding to implicit type conversions: small ints (in the range of [0..char.max]) will be implicitly converted to `char` if necessary.

Reply via email to