[Issue 23116] foreach with opApply infer ref when opApply delegate is templated

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 16 16:48:11 UTC 2022


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

Dlang Bot <dlang-bot at dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #1 from Dlang Bot <dlang-bot at dlang.rocks> ---
@ljmf00 created dlang/dmd pull request #14132 "fix(statementsem): foreach
shouldn't infer ref on templated opApply" fixing this issue:

- fix(statementsem): foreach shouldn't infer ref on templated opApply

  When a foreach with templated opApply, the compiler infers the
  following:

  ```d
  foreach(ref int i; S())
  ```

  Even if you explicitly type it as non-ref.

  Fix issue 23116.

  Reference: https://issues.dlang.org/show_bug.cgi?id=23116
  Signed-off-by: Luís Ferreira <contact at lsferreira.net>

https://github.com/dlang/dmd/pull/14132

--


More information about the Digitalmars-d-bugs mailing list