Bug? NVI functions can't call normal interface functions?

Johannes Pfau nospam at example.com
Sun Mar 17 06:29:28 PDT 2013


import core.stdc.stdio;
interface Timer
{
    final int run() { printf("Timer.run()\n"); fun(); return 1; };
    int fun();
}
interface Application
{
    final int run() { printf("Application.run()\n"); fun(); return 2; };
    int fun();
}

class TimedApp : Timer, Application
{
    int fun()
    {
        printf("TimedApp.fun()\n");
        return 0;
    }
}

void main()
{
    auto app = new TimedApp;
    (cast(Application)app).run();
    (cast(Timer)app).run();
    app.Application.run();
    app.Timer.run();
}

Output:
----
Application.run()
TimedApp.fun()
Timer.run()
TimedApp.fun()
Application.run()
Timer.run()
----

Note how "TimedApp.fun()" is called if cast was used, but not if
app.*Interface*. was called. I guess this is a bug?


More information about the Digitalmars-d mailing list