D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15639 - std.experimental.allocator enables abstract class instantiation
Summary: std.experimental.allocator enables abstract class instantiation
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-02 12:21 UTC by Olivier Pisano
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Olivier Pisano 2016-02-02 12:21:06 UTC
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
}
Comment 1 github-bugzilla 2016-03-04 23:03:45 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/175b9129a0293667371027fa68b85d9e7c78754e
fixed issue 15639

https://github.com/D-Programming-Language/phobos/commit/3edc09dfa4d4e6223409316d2dcde6d3fdec7066
Merge pull request #4023 from BBasile/ussue-15639

fixed issue 15639 - allocator.make enables abstract class instantiation