On Sunday, 3 November 2013 at 21:55:22 UTC, Simen Kjærås wrote:
Consider:
module foo;
struct S {
immutable(int)[] arr;
void fuzz() const pure {
}
}
void bar(S s) {
s.fuzz();
}
void main() {
shared S s;
bar(s); // a
s.fuzz(); // b
}
In this case, the line marked 'a' works perfectly - it compiles
and does what I'd expect it to.
However,the line marked 'b' does not compile - " non-shared
const method foo.S.fuzz is not callable using a shared mutable
object ".
It is because a imply a pass b value, when b a pass by reference.