Template conflict?
Mike L.
mike.linford at gmail.com
Sat Feb 14 23:20:50 PST 2009
Can anybody explain why I get the following error:
test.d(28): Error: test.tblahTemplate!(uint).tblah at test.d(13) conflicts with
test.tblahTemplate!(int).tblah at test.d(13)
When I try to compile this?:
test.d:
int blah(uint x)
{
return x;
}
int blah(int x)
{
return (x >= 0 ? x : -x);
}
version(WithT)
{
template tblahTemplate(Type)
{
Type tblah(Type x)
{
static if(Type.min == 0)
return x;
else
return (x >= 0 ? x : -x);
}
}
mixin tblahTemplate!(uint);
mixin tblahTemplate!(int);
}
void main()
{
blah(3);
version(WithT)
{
tblah(3);
}
}
It works without -version=WithT but not with it. Why can't it resolve it if it's a template?
Thanks,
Mike L.
More information about the Digitalmars-d-learn
mailing list