[Issue 22284] [DIP1000] function templates cannot infer scope in instances with indirections when accessing the address of fields

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 7 15:53:07 UTC 2021


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

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Dennis <dkorpel at live.nl> ---
I'm not sure why your cannotInfer examples fail, but canInfer3 and canInfer4
succeed because the parameter (This bar) in the lambda is inferred scope since
it's passed by value and the lambda is `pure` and returns `void`, so it can't
escape `arr`. The `scope` annotation of canInfer3 doesn't do anything since
it's not a `delegate` but a `function` since you pass `this` explicitly through
parameter `bar`.

--


More information about the Digitalmars-d-bugs mailing list