This is bug or not? (immutable class containing struct with dtor)

Denis Feklushkin feklushkin.denis at gmail.com
Sat Dec 18 11:01:53 UTC 2021


On Friday, 17 December 2021 at 19:03:05 UTC, Tejas wrote:

> Well, I got completely mislead by my experiment 😓
>
> ```d
> struct S
> {
>     ~this() immutable {}
> }
> ```

Interesting what discussed behaviour isn't affects method what 
implements same functionality as dtor and called explictly at 
each appropriate place.

So for dirty fix I just created

```d
     void __custom_dtor() const
     { ... }
```

And then called this __custom_dtor at each dtor what uses this 
struct.


More information about the Digitalmars-d-learn mailing list