September 09, 2005
D:\d\tctr>type main.d
import std.stdio;
int r = 1;
class B{
        void f(){
                writefln("B.f");
        }
}
final class D : B{
        void f(){
                --r;
                writefln("D.f");
                super.f();
        }
}
int main(){
        (new D).f();
        if(r)
                writefln("bug!");
        return r;
}

D:\d\tctr>dmd main.d
C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;

D:\d\tctr>main
D.f
B.f

D:\d\tctr>dmd main.d -inline
C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;

D:\d\tctr>main
D.f
D.f
B.f
bug!

D:\d\tctr>


Remarks: The bug disappears when the keyword "final" is removed
from the source.
September 10, 2005
zwang schrieb:

> D:\d\tctr>type main.d
> import std.stdio;
> int r = 1;
> class B{
>         void f(){
>                 writefln("B.f");
>         }
> }
> final class D : B{
>         void f(){
>                 --r;
>                 writefln("D.f");
>                 super.f();
>         }
> }
> int main(){
>         (new D).f();
>         if(r)
>                 writefln("bug!");
>         return r;
> }
> 
> D:\d\tctr>dmd main.d
> C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
> 
> D:\d\tctr>main
> D.f
> B.f
> 
> D:\d\tctr>dmd main.d -inline C:\dmd\bin\..\..\dm\bin\link.exe main,,,user32+kernel32/noi;
> 
> D:\d\tctr>main
> D.f
> D.f
> B.f
> bug!
> 
> D:\d\tctr>
> 
> 
> Remarks: The bug disappears when the keyword "final" is removed from the source.

Added to DStress as http://dstress.kuehne.cn/run/i/inline_14_A.d http://dstress.kuehne.cn/run/i/inline_14_B.d http://dstress.kuehne.cn/run/i/inline_14_C.d

Thomas