This is bug or not? (immutable class containing struct with dtor)
Denis Feklushkin
feklushkin.denis at gmail.com
Fri Dec 17 17:27:53 UTC 2021
```d
/+ dub.json:
{
"name": "test",
"dependencies": {
}
}
+/
struct S
{
~this() {}
}
immutable class Imm
{
S s; // this is immutable value because whole class is
immutable
this()
{
s = S();
}
~this() {} // Comment out this to fix this compilation error:
// Error: `immutable` method `serializer_bug.Imm.~this` is
not callable using a mutable object
// What mutable object is meant here?
}
void main()
{
auto ic = new immutable Imm();
}
```
Run: $ dub --single bug.d
More information about the Digitalmars-d-learn
mailing list