g++-5 errors out with this now with errors such as:
default_constructor_wrap.cxx:665:27: error: use of deleted function ‘FFF::FFF()’
result = (FFF *)new FFF();
^
default_constructor_wrap.cxx:314:7: note: ‘FFF::FFF()’ is implicitly deleted because the default definition would be ill-formed:
class FFF : public F {
^
default_constructor_wrap.cxx:301:4: error: ‘F::~F()’ is private
~F() { }
^
default_constructor_wrap.cxx:314:7: error: within this context
23 lines
531 B
D
23 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);
|
|
}
|
|
}
|
|
}
|