Skip to content

Commit

Permalink
Fix std.typecons.scoped problem with interface inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Aug 16, 2011
1 parent 6df27f5 commit 8a35dfc
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion std/typecons.d
Original file line number Diff line number Diff line change
Expand Up @@ -2569,7 +2569,7 @@ private void destroy(T)(T obj) if (is(T == class))
}
static if (!is(T == Object) && is(T Base == super))
{
Base b = obj;
Base[0] b = obj;
destroy(b);
}
}
Expand Down Expand Up @@ -2618,6 +2618,27 @@ unittest
assert(A.dead, "asdasd");
}

unittest
{
static class A {
static int sdtor;

this() { ++sdtor; assert(sdtor == 1); }
~this() { assert(sdtor == 1); --sdtor; }
}

interface Bob {}

static class ABob : A, Bob {
this() { ++sdtor; assert(sdtor == 2); }
~this() { assert(sdtor == 2); --sdtor; }
}

A.sdtor = 0;
scope(exit) assert(A.sdtor == 0);
auto abob = scoped!ABob();
}

/**
Defines a simple, self-documenting yes/no flag. This makes it easy for
APIs to define functions accepting flags without resorting to $(D
Expand Down

0 comments on commit 8a35dfc

Please sign in to comment.