predefined version for "nogc" option

a11e99z black80 at bk.ru
Thu Sep 5 14:42:16 UTC 2019


On Thursday, 5 September 2019 at 08:02:15 UTC, Kagamin wrote:
> At least
> void f() @nogc
> {
>     static assert(__traits(compiles,new int));
> }
> fails

u know that u haven't gc in blocks @nogc.

try to run
> static assert( __traits( compiles, new int));
> extern(C) int main() { return 0; }
for DMD/LDC:-betterC or LDC:-nogc

__traits( compiles, new int) is true.
but shouldn't cuz when u use "new int" in code u will get error - 
module compiled for noGC.
(probably we have issue here with __traits)
and I don't need error, I am trying to find workaround, so I need 
some flag/version to choose right code for version with GC and 
another.


More information about the digitalmars-d-ldc mailing list