...ing logging 4.0

はてなブログに移行しました。D言語の話とかいろいろ。

BUG: The overload and override issue of const/immutable member functions

こういう形で報告した.
3282 – The overload and override issue of const/immutable member functions

import std.stdio;
class Base
{
    string f()
    {
        return "Base.f()";
    }
}
class Derived : Base
{
    string f()
    {
        return "Derived.f()";
    }
    string f() const // or immutable
    {
        return "Derived.f() const";
    }
}
void main()
{
    auto x = new Base;
    writeln(x.f());
    auto y = new Derived;
    writeln(y.f());
    auto z = new const(Derived); // or immutable
    writeln(z.f()); //object.Error: Access Violation
}