DMD64 D Compiler v2.067.1
In the code below Parent.foo is somehow shadowed (but still accessible) inside Child.foo body.
Note that Parent.foo is "imported" to Child by alias declaration and is included in Child.foo overload set.
The same error occurs for both interfaces and classes.
test.d:
----------------------------------------
interface Parent
{
static void foo(T)() {}
static void foo(T : dchar)()
{
foo!int(); // OK
}
}
interface Child : Parent
{
alias foo = Parent.foo;
static void foo(T : char)()
{
Parent.foo!int(); // OK
Child.foo!int(); // OK
{ alias foo = Parent.foo; foo!int(); } // OK
{ alias foo = Child.foo; foo!int(); } // OK
foo!int(); // Error
}
}
void main()
{
Child.foo!char();
}
----------------------------------------
`dmd test` output:
----------------------------------------
test.d(21): Error: template instance foo!int does not match template declaration foo(T : char)()
test.d(27): Error: template instance test.Child.foo!char error instantiating
----------------------------------------
Comment #1 by robert.schadek — 2024-12-13T18:44:28Z