Skip to content

Commit

Permalink
Fix Issue 20232 - WhiteHole is unusable with @safe interface functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightSentinel committed Jan 27, 2020
1 parent 18bf58f commit 869d9b5
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion std/typecons.d
Expand Up @@ -4375,6 +4375,17 @@ alias BlackHole(Base) = AutoImplement!(Base, generateEmptyFunction, isAbstractFu
BlackHole!Foo o;
}

nothrow pure @safe unittest
{
static interface I
{
void foo() nothrow pure @nogc @safe;
}

auto cb = new BlackHole!I();
cb.foo();
}


/**
`WhiteHole!Base` is a subclass of `Base` which automatically implements
Expand Down Expand Up @@ -4408,10 +4419,25 @@ alias WhiteHole(Base) = AutoImplement!(Base, generateAssertTrap, isAbstractFunct
assertThrown!NotImplementedError(c.notYetImplemented()); // throws an Error
}

// https://issues.dlang.org/show_bug.cgi?id=20232
nothrow pure @safe unittest
{
static interface I
{
void foo() nothrow pure @safe;
}

if (0) // Just checking attribute interference
{
auto cw = new WhiteHole!I();
cw.foo();
}
}

// / ditto
class NotImplementedError : Error
{
this(string method)
this(string method) nothrow pure @safe
{
super(method ~ " is not implemented");
}
Expand Down

0 comments on commit 869d9b5

Please sign in to comment.