[Issue 22221] [dip1000] pure function can escape parameters through Exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 23 08:00:56 UTC 2021


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> ---
The problem here comes from the compiler automatically inferring `scope` for
the parameter `x` because it's a pure function, assuming that `x` cannot escape
it because `pure` disallows storing things in global variables.

The trouble is that escaping via a thrown exception was not taken into account.

--


More information about the Digitalmars-d-bugs mailing list