www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15010] New: Base interface member is shadowed inside the


          Issue ID: 15010
           Summary: Base interface member is shadowed inside the derived
                    interface member body (template overloading issue)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maximzms gmail.com

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. 

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()

`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

Sep 03 2015