The suggestion was to make the following condition statements as specializations.
if (__ctfe) { }
if (!__ctfe) { }
Then, anything in the __ctfe branch that can be evaluated at compile time but would otherwise cause a GC allocation at runtime would be permissible in @nogc functions.
Comment #2 by dlang-bot — 2022-03-25T16:47:58Z
@ibuclaw updated dlang/dmd pull request #7509 "Fix Issue 18119 - Mark if(__ctfe) blocks as SCOPEctfe" fixing this issue:
- Fix Issue 18119 - Mark if(__ctfe) blocks as SCOPEctfe
https://github.com/dlang/dmd/pull/7509
Comment #3 by robert.schadek — 2024-12-13T18:55:45Z