Like the previous bug I reported, this needs a filename of 3 characters, eg "bug.d".
In this example, there's a recursive template definition, (which is not actually called).
It's quite possible that all of these bugs are symptoms of bug#532.
Output:
-----
x
fun.d(17): Error: non-constant expression cast(char[])J!("xxx")
fun.d(17): Error: non-constant expression cast(char[])J!("xxx")
---------
template M(alias F)
{
enum E { xxxxx }
alias void function (E) G;
const char [] H = typeof(G).mangleof;
}
template J(char [] str)
{
static if (30==str.length)
const char [] J = "x";
else
const char [] J = J!("xxx");
}
template K(alias A)
{
const char [] K = J!(M!(A).H);
}
void main()
{
int q = 3;
pragma(msg, K!(q));
}
Comment #1 by bugzilla — 2006-11-30T03:25:18Z
DMD 0.174 gives:
test.d(13): Error: circular reference to 'J'
which I believe is correct.
Comment #2 by clugdbug — 2006-11-30T04:02:51Z
I get the sensible error message, too, when the filename is four characters long.
The bug only occurs for me with a filename of three characters.
Please retest this with a filename of three characters.
(eg tes.d).
Comment #3 by clugdbug — 2007-07-02T04:46:59Z
This now works in 1.018. It was probably fixed in 1.012 when bug#532 was fixed.