On 23/08/18 15:03, Walter Bright wrote:
So you will excuse me, but I don't think this bug is being taken as seriously as I think it should.

It is a serious problem. (There are workarounds available, like using scope(failure).)

I don't think you understand how unworkable this workaround is.

struct A {
  this(something);
  ~this();
}

struct B {
  A a;

  this(something) {
    a = A(something);
    // Safeguard against 14246
    scope(failure) destroy(a);

    // more code
  }
}

struct C {
  A a;

  this(something) {
    a = A(something);
    // Also needs a safeguard against 14246
    scope(failure) destroy(a);

    // more code
  }
}

struct D {
  this(something) {
    // Do nothing
  }
}

struct E {
  B b;
  D d;

  this(something) {
    b = B(something);
// B doesn't even have an explicit destructor, but we are supposed to look at its implementation and understand that it contains A, so:
    scope(failure) destroy(b);

    d = D(something);
    // D doesn't even contain A, but it might one day, so:
    scope(failure) destroy(d);
  }
}


The chances of this scheme actually working without errors are, more or less, zero.

Reply via email to