[Issue 21803] "@nogc:" incorrectly propagates into function blocks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 5 22:47:35 UTC 2021


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

Eyal <eyal at weka.io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal

--- Comment #1 from Eyal <eyal at weka.io> ---
A pure function incorrectly taints all delegates declared within it as pure as
well.

For example, this compiles:

__gshared string global;

  struct S {
      auto f() {
          scope dlg = { throw new Exception(global); };
      }
      static assert(hasFunctionAttributes!(f, "pure"));
  }

But this complains about the use of the global:

  struct T {
      pure
      void f() {
          scope dlg = { throw new Exception(global); };
      }
  }

--


More information about the Digitalmars-d-bugs mailing list