blob: 991b4186a9bcbab868bcb351c61bddf5f3496c71 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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);
}
}
}
|