Thread overview
[Issue 21803] "@nogc:" incorrectly propagates into function blocks, explicit "pure" too
[Issue 21803] "@nogc:" incorrectly propagates into function blocks
Apr 05, 2021
Eyal
Apr 05, 2021
Eyal
Apr 05, 2021
Eyal
Dec 17, 2022
Iain Buclaw
April 05, 2021
https://issues.dlang.org/show_bug.cgi?id=21803

Eyal <eyal@weka.io> changed:

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

--- Comment #1 from Eyal <eyal@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); };
      }
  }

--
April 05, 2021
https://issues.dlang.org/show_bug.cgi?id=21803

Eyal <eyal@weka.io> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|"@nogc:" incorrectly        |"@nogc:" incorrectly
                   |propagates into function    |propagates into function
                   |blocks                      |blocks, explicit "pure" too

--
April 05, 2021
https://issues.dlang.org/show_bug.cgi?id=21803

--- Comment #2 from Eyal <eyal@weka.io> ---
Interestingly, @safe/nothrow seem to behave just fine.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21803

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

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

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19904

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--