rejectedsoftware/vibe.d — pull request #877 by etcimon (2014-10-21 17:23:30+00:00)
Title: Accepting scoped default initialization

I'm currently trying to carry over scoped default declaration/initializations of class (inheritance) objects from C++.

This minor modifications seems to fit the bill pretty well, although I could probably use this in `scoped!` objects.

Here's how it looks:

import vibe.utils.memory;
import std.stdio;
class A { void print() { writeln("A"); } }
class B : A { override void print() { writeln("B"); } }
void print(A a) { a.print(); }
void main()
{
FreeListRef!B b;
print(b);
}

This prints `B`, whereas without the change in this pull request, the above code triggered a memory error.