On Wednesday, 24 July 2024 at 15:40:28 UTC, Dennis wrote:
Is there a way to tell the compiler that it should discard
"const" and "immutable" if it needs to create a copy?
Unqual!T doesn't work :-(
When you add `const` or `immutable` before the template type
parameter, it will infer T as simply `int`:
```D
T test2(T)(immutable T x) { return --T(x); }
```
Woah. Is this @safe?
Ok, I know this is a fresh copy, that hopefully doesn't go to
non-volatile memory, but I'm always sceptical casting away const.