Files
ANSLibs/swig-4.3.0/Examples/test-suite/d/default_constructor_runme.2.d

24 lines
531 B
D

module default_constructor_runme;
import default_constructor.G;
void main() {
// D2 does not support something akin to D1/Tango dispose() for deterministic
// destruction yet.
// enforceThrows((){ scope g = new G(); }, "Protected destructor exception should have been thrown");
}
private void enforceThrows(void delegate() dg, string errorMessage) {
bool hasThrown;
try {
dg();
} catch (Exception) {
hasThrown = true;
} finally {
if (!hasThrown) {
throw new Exception(errorMessage);
}
}
}