mutable destructor? WAT???

Jack Applegame via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 28 02:43:02 PDT 2016


object.destroy doesn't want to destroy const structure with 
destructor:

struct T {
     ~this() {}
}

void foo_t(ref T t) {
     destroy(t);  // works
}

void foo_ct(ref const T t) {
     destroy(t);  // Error: mutable method T.~this is not callable 
using a const object
}

Mutable destructor? O___o

With this difinition both functions compiles:

struct T {
     ~this() const {} // WAT???
}

Is there a bug in druntime?


More information about the Digitalmars-d-learn mailing list