On Wednesday, 17 January 2018 at 13:19:42 UTC, Nordlöw wrote:
Why isn't polymorphic down-casts such as in the following pattern matching on sub-class

class Base {}
class Sub : Base {}

@safe unittest
{
    auto base = new Base();
    if (auto sub = cast(Sub)base)
    {
        // use sub
    }
}

allowed in safe D?

Just discovered that the base instance was const. My mistake...

Reply via email to