Placement new and @trusted

IchorDev zxinsworld at gmail.com
Fri Sep 12 09:31:46 UTC 2025


On Thursday, 11 September 2025 at 17:16:35 UTC, Paul Backus wrote:
> ```d
> void inferSystem() @system pure nothrow @nogc {}
>
> T* example(T)() {
>     static if (!isSafe!(() { new T(); })
>         inferSystem();
>     return (() @trusted => new (new void[](T.sizeof)) T())();
> }
> ```

Unfortunately that would give you an incredibly unhelpful error 
message.


More information about the Digitalmars-d-learn mailing list