Is this a bug?
Li Jie
cpunion at gmail.com
Mon Apr 10 21:09:40 PDT 2006
Code:
template test(char[] str)
{
const char test = test1!(str[0]); // #LINE 87
}
template test1(char c)
{
const char test1 = c;
}
void main()
{
writefln(test!("a")); // #LINE 105
}
Compile error(dmd 0.150 and dmd 0.153):
testcom.d(87): str is used as a type
testcom.d(87): template instance test1!(void[0]) does not match any template
declaration
testcom.d(87): cannot implicitly convert expression (test1!(void[0])) of type
void to char
testcom.d(105): template instance testcom.test!("a") error instantiating
This is no error:
template test(char[] str)
{
const char test = test1!(str); // #LINE 87
}
template test1(char[] c)
{
const char test1 = c[0];
}
void main()
{
writefln(test!("a")); // #LINE 105
}
Thanks,
- Li Jie
More information about the Digitalmars-d
mailing list