[Issue 24208] [DIP1000] Scope pointer can escape via non-scope parameter of pure nested function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 30 04:38:52 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24208
Paul Backus <snarwin+bugzilla at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[DIP1000] Nested function |[DIP1000] Scope pointer can
|can pass scope pointer to |escape via non-scope
|non-scope parameter |parameter of pure nested
| |function
--- Comment #4 from Paul Backus <snarwin+bugzilla at gmail.com> ---
The bug is caused by an undocumented special-case language rule that allows
scope pointers to be assigned to non-scope parameters of pure functions in some
cases. This special case is implemented in the DMD frontend by the function
TypeFunction.parameterStorageClass.
In comment #1's example, `escape` is inferred to be weakly pure. As a result,
TypeFunction.parameterStorageClass allows the parameter `p` to accept a scope
pointer as an argument, and the error that would normally be issued by
checkParamArgumentEscape is suppressed.
--
More information about the Digitalmars-d-bugs
mailing list