[Issue 21209] scope attribute inference with does not work well with foreach

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 19 06:15:44 UTC 2021


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

Mathias LANG <pro.mathias.lang at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang at gmail.com

--- Comment #1 from Mathias LANG <pro.mathias.lang at gmail.com> ---
At first I thought it wasn't a bug because the type of `cs` is specified.
However, after changing `foo` to:
```
void foo(T)(T cs)
{
    foreach (c; cs)
        bar(c);
}
```

The error persist. The strangest part is that not calling `bar` from the
foreach makes the error go away.

--


More information about the Digitalmars-d-bugs mailing list