On Thursday, 8 March 2018 at 22:56:27 UTC, Henrik wrote:
why do I have to put the @nogc on the constructor and
destructor separately?

You can make things slightly better by putting @nogc in the struct itself:

struct S
{
  @nogc:

  void member1()
  {
  }

  void member2()
  {
  }
}

But, yeah, this is a current pain point: attributes aren't "deep". Maybe one day we'll have a syntax for applying attributes recursively, but I think it's blocking on the lack of a syntax for inverting an attribute. (I.e., a way to declare an impure/gc/whatever thing inside a region that's declared pure/nogc/whatever.)

Reply via email to