https://issues.dlang.org/show_bug.cgi?id=17771
Steven Schveighoffer <schvei...@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Steven Schveighoffer <schvei...@yahoo.com> --- The compiler doesn't attempt to modify attributes in almost any case. For instance: auto foo() { const int x = 5; return x; } auto y = foo(); // y is const(int), even though it could be just int So this behavior is consistent. You need to tell the compiler to make the copy with the correct attributes. Note that many many ranges are not implicitly copyable to a mutable version, so this ability would not help in most cases. One valid enhancement that you could propose is to add a function somewhere in phobos (probably in typecons) that returns a copy of the item with as many qualifiers removed as possible. Then your code could become something like: foreach(x; unqual(r)) --