https://issues.dlang.org/show_bug.cgi?id=15639

          Issue ID: 15639
           Summary: std.experimental.allocator enables abstract class
                    instantiation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: [email protected]
          Reporter: [email protected]

With std.experimental.allocator.make, one can instantiate an abstract class.
Calling an abstract method segfaults.

Tested with both 2.069.2 and 2.070.

import std.experimental.allocator;
import std.stdio;

abstract class Toto
{
    void f()
    {
        writeln("f() called");
    }

    abstract void g();
}

void main()
{
    auto toto = theAllocator.make!Toto(); 
    toto.f();                             // prints "f() called"
    toto.g();                             // segfaults
}

--

Reply via email to