[Issue 1698] New: foreach auto type inference doesnt work properly

Janice Caron caron800 at googlemail.com
Sat Dec 1 11:12:56 PST 2007


On 12/1/07, Sönke Ludwig <ludwig at informatik_dot_uni-luebeck.de> wrote:
> Since c inside of the foreach-loop is actually a "ref invariant(char)"
> (string = invariant(char)[]), it is correct that it cannot be passed to
> bar, taking a mutable "ref char".
> Changing bar to "void bar( ref invariant(char) c ){}" makes it compile
> again.

So... can you /assign/ a ref invariant(char)?

I'm confused as to why the code isn't just

    foreach(c;text)



More information about the Digitalmars-d-bugs mailing list