Placement new and @trusted

IchorDev zxinsworld at gmail.com
Wed Sep 10 13:04:49 UTC 2025


On Wednesday, 10 September 2025 at 12:41:22 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> Your calling a @system function (constructor) from a safe 
> function (main).
>
> Placement new doesn't change the rules around this.

You don't understand: I *WANT* the code *FAIL* to compile because 
`S`'s constructor is `@system`. But instead, the `@system` 
constructor gets through because I had to use `@trusted` to get 
placement new itself to be considered safe. If I have to manually 
check constructor safety to get around this then I might as well 
just use `emplace`, which would make this a completely worthless 
feature.


More information about the Digitalmars-d-learn mailing list