[Issue 18494] nogc ignores invariant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 22 13:36:55 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18494

--- Comment #1 from FeepingCreature <default_357-line at yahoo.de> ---
Reproduce:

class Class {
  invariant { new Object; }
  void foo() @nogc { }
}

void test() @nogc {
  (new Class).foo;
}

void main() { test(); }

Expected: error about gc allocation in @nogc violation

Outcome: runs silently

Further wrinkle:

void foo() @nogc in { new Object; } body { }
^ this one errors!

Either the second function should work (preferred) or the first one should also
error.

--


More information about the Digitalmars-d-bugs mailing list