On Fri, 06 May 2011 03:39:31 -0400, Mariusz Gliwiński
<alienballa...@gmail.com> wrote:
Is this bug, or is it as supposed to be? I'm not sure...
<code>
interface TmpI(T) {
void func(T);
}
class TmpC {}
class TmpC2 : TmpC {}
class Tmp : TmpI!TmpC2 {
void func(TmpI!TmpC) {};
Here is one problem, TmpI is instantiated with TmpC2 as the func
parameter, yet you use TmpI!TmpC as your func parameter. The func
parameter should be TmpC2. I'm surprised this part would compile without
complaining that you didn't implement func. But it probably would fail if
it got to that check.
}
void main(string[] args) {
auto inst = new Tmp;
inst.func(new Tmp);
Here is the real problem, Tmp is not a TmpI!TmpC2, it's a TmpI!TmpC. So
it cannot be cast (implicitly or explicitly). Implicit casting does not
work for template parameters, in other words, TmpI!TmpC2 does not
implicitly cast to TmpI!TmpC.
-Steve