digitalmars.D - Re: transporting qualifier from parameter to the return value
- Kagamin <spam here.lot> Dec 16 2009
Michel Fortin Wrote:class Test { void doThat() immutable {} void doThat() const {} void doThat() {} void doThat() shared immutable {} void doThat() shared const {} void doThat() shared {} void doSomething() inout // or vconst { doThat(); // which doThat does it call? } }
Const function will be called. I replied about sharing in another post.class Test { void doThat() immutable {} void doThat() shared immutable {} void doSomething() inout // or vconst { doThat(); // which doThat does it call? } }
It's a compile-time error: vconst is orthogonal to immutable, so you can't pass vconst(this) as immutable(this). Immutable methods are callable only on immutable data. Period.
Dec 16 2009