[Issue 17473] foreach on delegates incorrectly rejected

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 8 19:15:52 UTC 2021


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

Stanislav Blinov <stanislav.blinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stanislav.blinov at gmail.com

--- Comment #6 from Stanislav Blinov <stanislav.blinov at gmail.com> ---
This probably should be changed to accepts-invalid instead. Foreach is
documented as taking delegates with a ref parameter:

https://dlang.org/spec/statement.html#foreach-statement

...therefore that the line `foreach(x; &s.f);` compiles should be an error,
shouldn't it?

--


More information about the Digitalmars-d-bugs mailing list